test: pin the updates popup loading guard in sonarr and lidarr

draw_updates_popup shows the loading block when update text is already present but a refresh is still in flight. Both existing tests fed empty update text, so they only exercised the first half of the guard and dropping the is_loading conjunct went undetected.
This commit is contained in:
Dark-Alex-17 committed 2026-09-10 00:49:42 -06:00
1 parent e622be3288
commit 7e8072133c
4 files changed
+126

No files matched your search

@@ -0,0 +1,48 @@
---
source: src/ui/lidarr_ui/system/system_details_ui_tests.rs
expression: output
---
╭ Updates ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ Loading ... │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -70,6 +70,21 @@ mod tests {
insta::assert_snapshot!(format!("loading_{active_lidarr_block}"), output); insta::assert_snapshot!(format!("loading_{active_lidarr_block}"), output);
} }
#[test]
fn test_system_details_ui_updates_popup_is_loading_when_updates_are_present() {
let mut app = App::test_default_fully_populated();
app.is_loading = true;
app.push_navigation_stack(ActiveLidarrBlock::SystemUpdates.into());
assert!(!app.data.lidarr_data.updates.get_text().is_empty());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
SystemDetailsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
#[test] #[test]
fn test_system_details_ui_updates_popup_loading_when_empty() { fn test_system_details_ui_updates_popup_loading_when_empty() {
let mut app = App::test_default_fully_populated(); let mut app = App::test_default_fully_populated();
@@ -0,0 +1,48 @@
---
source: src/ui/sonarr_ui/system/system_details_ui_tests.rs
expression: output
---
╭ Updates ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ Loading ... │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -70,6 +70,21 @@ mod tests {
insta::assert_snapshot!(format!("loading_{active_sonarr_block}"), output); insta::assert_snapshot!(format!("loading_{active_sonarr_block}"), output);
} }
#[test]
fn test_system_details_ui_updates_popup_is_loading_when_updates_are_present() {
let mut app = App::test_default_fully_populated();
app.is_loading = true;
app.push_navigation_stack(ActiveSonarrBlock::SystemUpdates.into());
assert!(!app.data.sonarr_data.updates.get_text().is_empty());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
SystemDetailsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
#[test] #[test]
fn test_system_details_ui_updates_popup_loading_when_empty() { fn test_system_details_ui_updates_popup_loading_when_empty() {
let mut app = App::test_default_fully_populated(); let mut app = App::test_default_fully_populated();