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
@@ -11,7 +11,7 @@ mod tests {
|
||||
use crate::handlers::sonarr_handlers::library::delete_series_handler::DeleteSeriesHandler;
|
||||
use crate::handlers::sonarr_handlers::sonarr_handler_test_utils::utils::series;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, DELETE_SERIES_BLOCKS};
|
||||
use crate::models::sonarr_models::DeleteSeriesParams;
|
||||
use crate::models::sonarr_models::{DeleteSeriesParams, Series};
|
||||
|
||||
mod test_handle_scroll_up_and_down {
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -133,7 +133,14 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
app.data.sonarr_data.delete_series_files = true;
|
||||
app.data.sonarr_data.add_list_exclusion = true;
|
||||
app.data.sonarr_data.series.set_items(vec![series()]);
|
||||
app.data.sonarr_data.series.set_items(vec![
|
||||
Series {
|
||||
id: 999,
|
||||
..series()
|
||||
},
|
||||
series(),
|
||||
]);
|
||||
app.data.sonarr_data.series.select_index(Some(1));
|
||||
let expected_delete_series_params = DeleteSeriesParams {
|
||||
id: 1,
|
||||
delete_series_files: true,
|
||||
@@ -278,7 +285,14 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteSeriesPrompt.into());
|
||||
app.data.sonarr_data.delete_series_files = true;
|
||||
app.data.sonarr_data.add_list_exclusion = true;
|
||||
app.data.sonarr_data.series.set_items(vec![series()]);
|
||||
app.data.sonarr_data.series.set_items(vec![
|
||||
Series {
|
||||
id: 999,
|
||||
..series()
|
||||
},
|
||||
series(),
|
||||
]);
|
||||
app.data.sonarr_data.series.select_index(Some(1));
|
||||
let expected_delete_series_params = DeleteSeriesParams {
|
||||
id: 1,
|
||||
delete_series_files: true,
|
||||
@@ -345,7 +359,14 @@ mod tests {
|
||||
#[test]
|
||||
fn test_build_delete_series_params() {
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.series.set_items(vec![series()]);
|
||||
app.data.sonarr_data.series.set_items(vec![
|
||||
Series {
|
||||
id: 999,
|
||||
..series()
|
||||
},
|
||||
series(),
|
||||
]);
|
||||
app.data.sonarr_data.series.select_index(Some(1));
|
||||
app.data.sonarr_data.delete_series_files = true;
|
||||
app.data.sonarr_data.add_list_exclusion = true;
|
||||
let expected_delete_series_params = DeleteSeriesParams {
|
||||
|
||||
Reference in new issue
Block a user