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

Readarr handler tests never asserted which block the search and filter keys push, so transposing searching_block and filtering_block in a TableHandlingConfig went undetected. History already had both tests; add the five missing search key tests and the three missing filter key tests, covering the authors, books, author history, editions and book history tables. The books and editions tables configure no filtering_block, so they get no filter test.

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 profile, monitor and root folder lists inside the add author, edit author and add root folder prompts are a separate gap that a table-only sweep misses, so those are covered too, as are the book files, editions and releases tables held on the book details modal.

Several fixtures also asserted against a default value, so the expected result was indistinguishable from an unset field. The add author, edit author and add root folder bodies now expect non-default monitor options, and the quality and metadata profile ids are drawn from disjoint id pairs so the two lookups cannot be transposed.
This commit is contained in:
Dark-Alex-17 committed 2026-09-09 16:22:51 -06:00
1 parent f141e53f30
commit cef1ad13af
8 files changed
+447 -89

No files matched your search

@@ -571,11 +571,8 @@ mod tests {
#[test]
fn test_toggle_monitoring_key() {
let mut app = App::test_default();
app
.data
.readarr_data
.authors
.set_items(vec![Author::default()]);
app.data.readarr_data.authors.set_items(authors_vec());
app.data.readarr_data.authors.select_index(Some(1));
app.push_navigation_stack(ActiveReadarrBlock::Authors.into());
app.is_routing = false;
@@ -592,7 +589,7 @@ mod tests {
assert!(app.is_routing);
assert_some_eq_x!(
&app.data.readarr_data.prompt_confirm_action,
&ReadarrEvent::ToggleAuthorMonitoring(0)
&ReadarrEvent::ToggleAuthorMonitoring(2)
);
}
@@ -704,6 +701,40 @@ mod tests {
assert!(!app.should_refresh);
}
#[test]
fn test_search_authors_key() {
let mut app = App::test_default();
app.data.readarr_data.authors.set_items(authors_vec());
app.push_navigation_stack(ActiveReadarrBlock::Authors.into());
LibraryHandler::new(
DEFAULT_KEYBINDINGS.search.key,
&mut app,
ActiveReadarrBlock::Authors,
None,
)
.handle();
assert_navigation_pushed!(app, ActiveReadarrBlock::SearchAuthors.into());
}
#[test]
fn test_filter_authors_key() {
let mut app = App::test_default();
app.data.readarr_data.authors.set_items(authors_vec());
app.push_navigation_stack(ActiveReadarrBlock::Authors.into());
LibraryHandler::new(
DEFAULT_KEYBINDINGS.filter.key,
&mut app,
ActiveReadarrBlock::Authors,
None,
)
.handle();
assert_navigation_pushed!(app, ActiveReadarrBlock::FilterAuthors.into());
}
#[test]
fn test_update_all_authors_prompt_confirm() {
let mut app = App::test_default();