From 78f5045844e26f1c6a470c21322d7013fa0c43fe Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Wed, 9 Sep 2026 17:00:49 -0600 Subject: [PATCH] test: pin extract_task_name against a real selected task Both tests seeded a single default task and asserted the extracted name equalled the default task name, so a body that ignored the table entirely and returned the default satisfied them. Radarr and Readarr already seed distinct named tasks and select one; these two now follow that shape. Verified by replacing both bodies with a bare default task name. The Lidarr test could not have failed before, since it compared the default against itself, and the run confirms it is the only Lidarr test that catches the change. The Sonarr body was already caught by the two start task prompt tests, so there the dedicated test is strengthened rather than newly load bearing. --- .../system/system_details_handler_tests.rs | 18 ++++++++++++------ .../system/system_details_handler_tests.rs | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/handlers/lidarr_handlers/system/system_details_handler_tests.rs b/src/handlers/lidarr_handlers/system/system_details_handler_tests.rs index 0487ef52..03749144 100644 --- a/src/handlers/lidarr_handlers/system/system_details_handler_tests.rs +++ b/src/handlers/lidarr_handlers/system/system_details_handler_tests.rs @@ -970,11 +970,17 @@ mod tests { #[test] fn test_extract_task_name() { let mut app = App::test_default(); - app - .data - .lidarr_data - .tasks - .set_items(vec![LidarrTask::default()]); + app.data.lidarr_data.tasks.set_items(vec![ + LidarrTask { + task_name: LidarrTaskName::Backup, + ..LidarrTask::default() + }, + LidarrTask { + task_name: LidarrTaskName::RefreshArtist, + ..LidarrTask::default() + }, + ]); + app.data.lidarr_data.tasks.select_index(Some(1)); let task_name = SystemDetailsHandler::new( DEFAULT_KEYBINDINGS.esc.key, @@ -984,7 +990,7 @@ mod tests { ) .extract_task_name(); - assert_eq!(task_name, LidarrTaskName::default()); + assert_eq!(task_name, LidarrTaskName::RefreshArtist); } #[test] diff --git a/src/handlers/sonarr_handlers/system/system_details_handler_tests.rs b/src/handlers/sonarr_handlers/system/system_details_handler_tests.rs index 6874edec..49d54511 100644 --- a/src/handlers/sonarr_handlers/system/system_details_handler_tests.rs +++ b/src/handlers/sonarr_handlers/system/system_details_handler_tests.rs @@ -984,11 +984,17 @@ mod tests { #[test] fn test_extract_task_name() { let mut app = App::test_default(); - app - .data - .sonarr_data - .tasks - .set_items(vec![SonarrTask::default()]); + app.data.sonarr_data.tasks.set_items(vec![ + SonarrTask { + task_name: SonarrTaskName::Backup, + ..SonarrTask::default() + }, + SonarrTask { + task_name: SonarrTaskName::RefreshSeries, + ..SonarrTask::default() + }, + ]); + app.data.sonarr_data.tasks.select_index(Some(1)); let task_name = SystemDetailsHandler::new( DEFAULT_KEYBINDINGS.esc.key, @@ -998,7 +1004,7 @@ mod tests { ) .extract_task_name(); - assert_eq!(task_name, SonarrTaskName::default()); + assert_eq!(task_name, SonarrTaskName::RefreshSeries); } #[test]