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

Sonarr 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 test for each of the
six searchable tables and a filter key test for each of the four filterable
ones, covering library, history, series details and season details.

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, adding a
decoy entry at index 0 so existing expected values stay meaningful. The
modal list selections in the add and edit series prompts are a separate
gap that a table-only sweep misses, so those are covered too.

Several fixtures also asserted against a default value, so the expected
result was indistinguishable from an unset field. The system tasks now use
two distinct non-default task names, the season monitoring and manual
search expectations use distinct non-zero ids, and the add and edit series
bodies expect a non-default series type and monitor with distinct quality
and language profile ids so the two lookups cannot be transposed.
This commit is contained in:
Dark-Alex-17 committed 2026-09-09 11:25:34 -06:00
1 parent 4cbec79334
commit 18a50ab97c
14 files changed
+994 -146

No files matched your search

@@ -153,11 +153,14 @@ mod tests {
#[case] expected_action: SonarrEvent,
) {
let mut app = App::test_default();
app
.data
.sonarr_data
.downloads
.set_items(vec![download_record()]);
app.data.sonarr_data.downloads.set_items(vec![
DownloadRecord {
id: 999,
..download_record()
},
download_record(),
]);
app.data.sonarr_data.downloads.select_index(Some(1));
app.data.sonarr_data.prompt_confirm = true;
app.push_navigation_stack(base_route.into());
app.push_navigation_stack(prompt_block.into());
@@ -350,11 +353,14 @@ mod tests {
#[case] expected_action: SonarrEvent,
) {
let mut app = App::test_default();
app
.data
.sonarr_data
.downloads
.set_items(vec![download_record()]);
app.data.sonarr_data.downloads.set_items(vec![
DownloadRecord {
id: 999,
..download_record()
},
download_record(),
]);
app.data.sonarr_data.downloads.select_index(Some(1));
app.push_navigation_stack(base_route.into());
app.push_navigation_stack(prompt_block.into());
@@ -408,11 +414,14 @@ mod tests {
#[test]
fn test_extract_download_id() {
let mut app = App::test_default();
app
.data
.sonarr_data
.downloads
.set_items(vec![download_record()]);
app.data.sonarr_data.downloads.set_items(vec![
DownloadRecord {
id: 999,
..download_record()
},
download_record(),
]);
app.data.sonarr_data.downloads.select_index(Some(1));
let download_id = DownloadsHandler::new(
DEFAULT_KEYBINDINGS.esc.key,