test(radarr): pin table search, filter and selection behaviour

Radarr handler tests never asserted which block the search and filter keys
push, so transposing searching_block and filtering_block in a
TableHandlingConfig went undetected. Add a search key and a filter key test
for each of the three handlers that configure them: library, collections and
history.

No test moved a table or list selection off index 0 either, which made
current_selection() and items[0] indistinguishable. Select a non-zero index
in the tests covering every handler that reads a selected row, enriching
fixtures with a second, distinct entry where only one existed.

Several fixtures also asserted against a default value, so the expected
result was indistinguishable from an unset field. The system details tasks
now use two distinct non-default task names, and the add movie body expects
a non-default monitor and minimum availability.
This commit is contained in:
Dark-Alex-17 committed 2026-09-09 10:47:07 -06:00
1 parent c9244b0459
commit 4cbec79334
16 files changed
+481 -133

No files matched your search

@@ -136,7 +136,7 @@ mod tests {
#[case(
ActiveRadarrBlock::Downloads,
ActiveRadarrBlock::DeleteDownloadPrompt,
RadarrEvent::DeleteDownload(1)
RadarrEvent::DeleteDownload(2)
)]
#[case(
ActiveRadarrBlock::Downloads,
@@ -149,11 +149,15 @@ mod tests {
#[case] expected_action: RadarrEvent,
) {
let mut app = App::test_default();
app
.data
.radarr_data
.downloads
.set_items(vec![download_record()]);
app.data.radarr_data.downloads.set_items(vec![
download_record(),
DownloadRecord {
id: 2,
title: "Test Download Title 2".to_owned(),
..download_record()
},
]);
app.data.radarr_data.downloads.select_index(Some(1));
app.data.radarr_data.prompt_confirm = true;
app.push_navigation_stack(base_route.into());
app.push_navigation_stack(prompt_block.into());
@@ -332,7 +336,7 @@ mod tests {
#[case(
ActiveRadarrBlock::Downloads,
ActiveRadarrBlock::DeleteDownloadPrompt,
RadarrEvent::DeleteDownload(1)
RadarrEvent::DeleteDownload(2)
)]
#[case(
ActiveRadarrBlock::Downloads,
@@ -345,11 +349,15 @@ mod tests {
#[case] expected_action: RadarrEvent,
) {
let mut app = App::test_default();
app
.data
.radarr_data
.downloads
.set_items(vec![download_record()]);
app.data.radarr_data.downloads.set_items(vec![
download_record(),
DownloadRecord {
id: 2,
title: "Test Download Title 2".to_owned(),
..download_record()
},
]);
app.data.radarr_data.downloads.select_index(Some(1));
app.push_navigation_stack(base_route.into());
app.push_navigation_stack(prompt_block.into());
@@ -403,11 +411,15 @@ mod tests {
#[test]
fn test_extract_download_id() {
let mut app = App::test_default();
app
.data
.radarr_data
.downloads
.set_items(vec![download_record()]);
app.data.radarr_data.downloads.set_items(vec![
download_record(),
DownloadRecord {
id: 2,
title: "Test Download Title 2".to_owned(),
..download_record()
},
]);
app.data.radarr_data.downloads.select_index(Some(1));
let download_id = DownloadsHandler::new(
DEFAULT_KEYBINDINGS.esc.key,
@@ -417,7 +429,7 @@ mod tests {
)
.extract_download_id();
assert_eq!(download_id, 1);
assert_eq!(download_id, 2);
}
#[test]