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
Generated
+36
View File
@@ -231,6 +231,17 @@ dependencies = [
"static_assertions",
]
[[package]]
name = "console"
version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87"
dependencies = [
"encode_unicode",
"libc",
"windows-sys 0.61.2",
]
[[package]]
name = "crossterm"
version = "0.28.1"
@@ -296,6 +307,12 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "encode_unicode"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -612,6 +629,18 @@ dependencies = [
"rustversion",
]
[[package]]
name = "insta"
version = "1.47.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4a6248eb93a4401ed2f37dfe8ea592d3cf05b7cf4f8efa867b6895af7e094e"
dependencies = [
"console",
"once_cell",
"similar",
"tempfile",
]
[[package]]
name = "instability"
version = "0.3.12"
@@ -1179,6 +1208,12 @@ dependencies = [
"libc",
]
[[package]]
name = "similar"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
[[package]]
name = "slab"
version = "0.4.12"
@@ -1489,6 +1524,7 @@ version = "0.1.0"
dependencies = [
"color-eyre",
"crossterm",
"insta",
"nix",
"prost",
"ratatui",