feat: add insta snapshot testing for TUI components
- Add insta dev-dependency for visual regression testing - Create lib.rs to expose modules for integration tests - Add snapshot tests for progress_bar, topbar, library, help modal - Add unit tests for LibraryState navigation - Move all tests to tests/ directory (proper Rust convention) - Make build.rs skip proto compilation when protoc unavailable - Add docs/testing-possible-solutions.md with testing strategies
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let proto_root = "../music-agregator/proto";
|
||||
let proto_file = format!("{}/music_agregator/v1/music_agregator.proto", proto_root);
|
||||
|
||||
let proto_file_exists = std::path::Path::new(&proto_file).exists();
|
||||
let protoc_available = std::process::Command::new("protoc")
|
||||
.arg("--version")
|
||||
.output()
|
||||
.is_ok();
|
||||
|
||||
if !proto_file_exists || !protoc_available {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
tonic_build::configure()
|
||||
.build_server(false)
|
||||
.build_client(true)
|
||||
.out_dir("src/proto")
|
||||
.compile_protos(
|
||||
&[format!(
|
||||
"{}/music_agregator/v1/music_agregator.proto",
|
||||
proto_root
|
||||
)],
|
||||
&[proto_root],
|
||||
)?;
|
||||
.compile_protos(&[proto_file], &[proto_root])?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user