test: Implemented UI snapshot tests

This commit is contained in:
Dark-Alex-17 committed 2025-12-12 15:44:11 -07:00
1 parent c3fa689617
commit 82f30f126d
121 files changed
+3720 -43

No files matched your search

@@ -0,0 +1,30 @@
---
source: src/ui/radarr_ui/system/system_details_ui_tests.rs
expression: output
---
╭ Tasks ───────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ Loading ... │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,30 @@
---
source: src/ui/radarr_ui/system/system_details_ui_tests.rs
expression: output
---
╭ Log Details ─────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,34 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ─────────────────────────────────────────────────╮╭ Queued Events ─────────────────────────────────────────╮
│ ││ │
│ ││ │
│ Loading ... ││ Loading ... │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
╰──────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────╯
╭ Logs ──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ Loading ... │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,34 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ─────────────────────────────────────────────────╮╭ Queued Events ─────────────────────────────────────────╮
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
╰──────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────╯
╭ Logs ──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -2,11 +2,14 @@
mod tests {
use strum::IntoEnumIterator;
use crate::app::App;
use crate::models::servarr_data::radarr::radarr_data::{
ActiveRadarrBlock, SYSTEM_DETAILS_BLOCKS,
};
use crate::ui::DrawUi;
use crate::ui::radarr_ui::system::system_details_ui::SystemDetailsUi;
use crate::ui::ui_test_utils::test_utils::render_to_string_with_app;
#[test]
fn test_system_details_ui_accepts() {
@@ -18,4 +21,37 @@ mod tests {
}
});
}
#[test]
fn test_system_details_ui_renders_loading_tasks() {
let mut app = App::test_default();
app.is_loading = true;
app.push_navigation_stack(ActiveRadarrBlock::SystemTasks.into());
let output = render_to_string_with_app(120, 30, &mut app, |f, app| {
SystemDetailsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
#[test]
fn test_system_details_ui_renders_logs() {
let mut app = App::test_default();
app.push_navigation_stack(ActiveRadarrBlock::SystemLogs.into());
app.data.radarr_data.logs.set_items(vec![
"2023-01-01T12:00:00Z | Info | Test log message 1"
.to_owned()
.into(),
"2023-01-01T12:01:00Z | Warn | Test warning message"
.to_owned()
.into(),
]);
let output = render_to_string_with_app(120, 30, &mut app, |f, app| {
SystemDetailsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
}
@@ -2,11 +2,13 @@
mod tests {
use strum::IntoEnumIterator;
use crate::app::App;
use crate::models::servarr_data::radarr::radarr_data::{
ActiveRadarrBlock, SYSTEM_DETAILS_BLOCKS,
};
use crate::ui::DrawUi;
use crate::ui::radarr_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,29 @@ mod tests {
}
});
}
#[test]
fn test_system_ui_renders_loading_state() {
let mut app = App::test_default();
app.is_loading = true;
app.push_navigation_stack(ActiveRadarrBlock::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(ActiveRadarrBlock::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);
}
}