test: Created snapshot tests for all Radarr UI modules
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
#[cfg(test)]
|
||||
mod snapshot_tests {
|
||||
use crate::app::App;
|
||||
use crate::handlers::populate_keymapping_table;
|
||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||
use crate::ui;
|
||||
use crate::ui::ui_test_utils::test_utils::{TerminalSize, render_to_string_with_app};
|
||||
|
||||
#[test]
|
||||
fn test_radarr_ui_renders_library_tab() {
|
||||
let mut app = App::test_default_fully_populated();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::default().into());
|
||||
|
||||
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
|
||||
ui(f, app);
|
||||
});
|
||||
|
||||
insta::assert_snapshot!(output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_radarr_ui_renders_library_tab_with_error() {
|
||||
let mut app = App::test_default_fully_populated();
|
||||
app.error = "Some error".into();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::default().into());
|
||||
|
||||
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
|
||||
ui(f, app);
|
||||
});
|
||||
|
||||
insta::assert_snapshot!(output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_radarr_ui_renders_library_tab_error_popup() {
|
||||
let mut app = App::test_default_fully_populated();
|
||||
populate_keymapping_table(&mut app);
|
||||
app.push_navigation_stack(ActiveRadarrBlock::default().into());
|
||||
|
||||
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
|
||||
ui(f, app);
|
||||
});
|
||||
|
||||
insta::assert_snapshot!(output);
|
||||
}
|
||||
|
||||
// TODO after adding fully populated Sonarr data
|
||||
// #[test]
|
||||
// fn test_sonarr_ui_renders_library_tab() {
|
||||
// let mut app = App::test_default_fully_populated();
|
||||
// app.push_navigation_stack(ActiveSonarrBlock::default().into());
|
||||
//
|
||||
// let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
|
||||
// ui(f, app);
|
||||
// });
|
||||
//
|
||||
// insta::assert_snapshot!(output);
|
||||
// }
|
||||
//
|
||||
// #[test]
|
||||
// fn test_sonarr_ui_renders_library_tab_with_error() {
|
||||
// let mut app = App::test_default_fully_populated();
|
||||
// app.push_navigation_stack(ActiveSonarrBlock::default().into());
|
||||
// app.error = "Some error".into();
|
||||
//
|
||||
// let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
|
||||
// ui(f, app);
|
||||
// });
|
||||
//
|
||||
// insta::assert_snapshot!(output);
|
||||
// }
|
||||
//
|
||||
// #[test]
|
||||
// fn test_sonarr_ui_renders_library_tab_error_popup() {
|
||||
// let mut app = App::test_default_fully_populated();
|
||||
// populate_keymapping_table(&mut app);
|
||||
// app.push_navigation_stack(ActiveSonarrBlock::default().into());
|
||||
//
|
||||
// let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
|
||||
// ui(f, app);
|
||||
// });
|
||||
//
|
||||
// insta::assert_snapshot!(output);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user