test: Implemented UI snapshot tests

This commit is contained in:
2025-12-12 15:44:11 -07:00
parent c3fa689617
commit 82f30f126d
121 changed files with 3720 additions and 43 deletions
@@ -2,11 +2,13 @@
mod tests {
use strum::IntoEnumIterator;
use crate::app::App;
use crate::models::servarr_data::sonarr::sonarr_data::{
ActiveSonarrBlock, SYSTEM_DETAILS_BLOCKS,
};
use crate::ui::DrawUi;
use crate::ui::sonarr_ui::system::SystemUi;
use crate::ui::ui_test_utils::test_utils::render_to_string_with_app;
#[test]
fn test_system_ui_accepts() {
@@ -22,4 +24,33 @@ mod tests {
}
});
}
mod snapshot_tests {
use super::*;
#[test]
fn test_system_ui_renders_loading_state() {
let mut app = App::test_default();
app.is_loading = true;
app.push_navigation_stack(ActiveSonarrBlock::System.into());
let output = render_to_string_with_app(120, 30, &mut app, |f, app| {
SystemUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
#[test]
fn test_system_ui_renders_system_menu() {
let mut app = App::test_default();
app.push_navigation_stack(ActiveSonarrBlock::System.into());
let output = render_to_string_with_app(120, 30, &mut app, |f, app| {
SystemUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
}
}