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:
14 files changed
+994
-146
No files matched your search
@@ -148,6 +148,11 @@ mod tests {
|
||||
} else {
|
||||
"usenet".to_owned()
|
||||
};
|
||||
let decoy_protocol = if torrent_protocol {
|
||||
"usenet".to_owned()
|
||||
} else {
|
||||
"torrent".to_owned()
|
||||
};
|
||||
let mut expected_edit_indexer_modal = EditIndexerModal {
|
||||
name: "Test".into(),
|
||||
enable_rss: Some(true),
|
||||
@@ -191,7 +196,14 @@ mod tests {
|
||||
fields: Some(fields),
|
||||
..Indexer::default()
|
||||
};
|
||||
sonarr_data.indexers.set_items(vec![indexer]);
|
||||
sonarr_data.indexers.set_items(vec![
|
||||
Indexer {
|
||||
protocol: decoy_protocol,
|
||||
..Indexer::default()
|
||||
},
|
||||
indexer,
|
||||
]);
|
||||
sonarr_data.indexers.select_index(Some(1));
|
||||
app.data.sonarr_data = sonarr_data;
|
||||
|
||||
IndexersHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
@@ -239,7 +251,14 @@ mod tests {
|
||||
#[test]
|
||||
fn test_delete_indexer_prompt_confirm_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.indexers.set_items(vec![indexer()]);
|
||||
app.data.sonarr_data.indexers.set_items(vec![
|
||||
Indexer {
|
||||
id: 999,
|
||||
..indexer()
|
||||
},
|
||||
indexer(),
|
||||
]);
|
||||
app.data.sonarr_data.indexers.select_index(Some(1));
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
@@ -538,7 +557,14 @@ mod tests {
|
||||
#[test]
|
||||
fn test_delete_indexer_prompt_confirm() {
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.indexers.set_items(vec![indexer()]);
|
||||
app.data.sonarr_data.indexers.set_items(vec![
|
||||
Indexer {
|
||||
id: 999,
|
||||
..indexer()
|
||||
},
|
||||
indexer(),
|
||||
]);
|
||||
app.data.sonarr_data.indexers.select_index(Some(1));
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
|
||||
@@ -649,7 +675,14 @@ mod tests {
|
||||
#[test]
|
||||
fn test_extract_indexer_id() {
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.indexers.set_items(vec![indexer()]);
|
||||
app.data.sonarr_data.indexers.set_items(vec![
|
||||
Indexer {
|
||||
id: 999,
|
||||
..indexer()
|
||||
},
|
||||
indexer(),
|
||||
]);
|
||||
app.data.sonarr_data.indexers.select_index(Some(1));
|
||||
|
||||
let indexer_id = IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
|
||||
Reference in new issue
Block a user