test: Implemented UI snapshot tests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user