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

@@ -391,6 +391,12 @@ mod tests {
fn test_toggle_monitoring_key() {
let mut app = App::test_default();
app.data.radarr_data = create_test_radarr_data();
app
.data
.radarr_data
.movies
.set_items(vec![movie(), Movie { id: 2, ..movie() }]);
app.data.radarr_data.movies.select_index(Some(1));
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
app.is_routing = false;
@@ -407,7 +413,7 @@ mod tests {
assert!(app.is_routing);
assert_some_eq_x!(
&app.data.radarr_data.prompt_confirm_action,
&RadarrEvent::ToggleMovieMonitoring(0)
&RadarrEvent::ToggleMovieMonitoring(2)
);
}
@@ -519,6 +525,48 @@ mod tests {
assert!(!app.should_refresh);
}
#[test]
fn test_search_movies_key() {
let mut app = App::test_default();
app
.data
.radarr_data
.movies
.set_items(vec![Movie::default()]);
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
LibraryHandler::new(
DEFAULT_KEYBINDINGS.search.key,
&mut app,
ActiveRadarrBlock::Movies,
None,
)
.handle();
assert_navigation_pushed!(app, ActiveRadarrBlock::SearchMovie.into());
}
#[test]
fn test_filter_movies_key() {
let mut app = App::test_default();
app
.data
.radarr_data
.movies
.set_items(vec![Movie::default()]);
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
LibraryHandler::new(
DEFAULT_KEYBINDINGS.filter.key,
&mut app,
ActiveRadarrBlock::Movies,
None,
)
.handle();
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterMovies.into());
}
#[test]
fn test_update_all_movies_prompt_confirm() {
let mut app = App::test_default();
@@ -621,7 +669,12 @@ mod tests {
#[test]
fn test_extract_movie_id() {
let mut app = App::test_default();
app.data.radarr_data.movies.set_items(vec![movie()]);
app
.data
.radarr_data
.movies
.set_items(vec![movie(), Movie { id: 2, ..movie() }]);
app.data.radarr_data.movies.select_index(Some(1));
let movie_id = LibraryHandler::new(
DEFAULT_KEYBINDINGS.esc.key,
@@ -631,7 +684,7 @@ mod tests {
)
.extract_movie_id();
assert_eq!(movie_id, 1);
assert_eq!(movie_id, 2);
}
#[test]