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:
Alexander
2026-05-09 11:35:10 +02:00
parent f7660436c2
commit 5bee7092d3
25 changed files with 799 additions and 115 deletions
+12 -7
View File
@@ -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(())
}