refactor: Created dedicated proptests and assertions to clean up the handler unit tests
This commit is contained in:
Generated
+68
@@ -188,6 +188,21 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
|
||||
dependencies = [
|
||||
"bit-vec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.4"
|
||||
@@ -1387,6 +1402,7 @@ dependencies = [
|
||||
"mockito",
|
||||
"openssl",
|
||||
"pretty_assertions",
|
||||
"proptest",
|
||||
"ratatui",
|
||||
"regex",
|
||||
"reqwest",
|
||||
@@ -1809,6 +1825,31 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proptest"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bit-vec",
|
||||
"bitflags",
|
||||
"num-traits",
|
||||
"rand 0.9.2",
|
||||
"rand_chacha 0.9.0",
|
||||
"rand_xorshift",
|
||||
"regex-syntax",
|
||||
"rusty-fork",
|
||||
"tempfile",
|
||||
"unarray",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.38.3"
|
||||
@@ -1892,6 +1933,15 @@ dependencies = [
|
||||
"getrandom 0.3.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a"
|
||||
dependencies = [
|
||||
"rand_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.29.0"
|
||||
@@ -2133,6 +2183,18 @@ version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||
|
||||
[[package]]
|
||||
name = "rusty-fork"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"quick-error",
|
||||
"tempfile",
|
||||
"wait-timeout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.20"
|
||||
@@ -2760,6 +2822,12 @@ dependencies = [
|
||||
"unsafe-any-ors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unarray"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.18"
|
||||
|
||||
@@ -73,6 +73,7 @@ assert_cmd = "2.0.16"
|
||||
mockall = "0.13.0"
|
||||
mockito = "1.0.0"
|
||||
pretty_assertions = "1.3.0"
|
||||
proptest = "1.6.0"
|
||||
rstest = "0.25.0"
|
||||
serial_test = "3.2.0"
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Seeds for failure cases proptest has generated in the past. It is
|
||||
# automatically read and these particular cases re-run before any
|
||||
# novel cases are generated.
|
||||
#
|
||||
# It is recommended to check this file in to source control so that
|
||||
# everyone who runs the test benefits from these saved cases.
|
||||
cc 56330c025ad79db641d0eb9f429ab74e95822e1fb015b58f0e158ea674cd42a1 # shrinks to list_size = 1, page_ops = 1
|
||||
@@ -0,0 +1,9 @@
|
||||
# Seeds for failure cases proptest has generated in the past. It is
|
||||
# automatically read and these particular cases re-run before any
|
||||
# novel cases are generated.
|
||||
#
|
||||
# It is recommended to check this file in to source control so that
|
||||
# everyone who runs the test benefits from these saved cases.
|
||||
cc fb4b58aa3015a125fc33a78dfaf27981db4191247151b327a351fc445e07c231 # shrinks to input = "j"
|
||||
cc d6ec17d4d3f635f0a095ade650a316d26abc1f9fe2b6d9cf67bf2f8b4ebedb60 # shrinks to backspace_count = 0
|
||||
cc cd46ee46e18cf86c940fb89c7206f0b482909880b8f2eabe3dd20682b9912c8a # shrinks to input = "h"
|
||||
@@ -0,0 +1,221 @@
|
||||
#[cfg(test)]
|
||||
mod property_tests {
|
||||
use proptest::prelude::*;
|
||||
|
||||
use crate::app::App;
|
||||
use crate::handlers::handler_test_utils::test_utils::proptest_helpers::*;
|
||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::models::radarr_models::Movie;
|
||||
use crate::models::{Scrollable, Paginated};
|
||||
|
||||
proptest! {
|
||||
/// Property test: Table never panics on index selection
|
||||
#[test]
|
||||
fn test_table_index_selection_safety(
|
||||
list_size in list_size(),
|
||||
index in 0usize..1000
|
||||
) {
|
||||
let mut table = StatefulTable::<Movie>::default();
|
||||
let movies: Vec<Movie> = (0..list_size).map(|i| {
|
||||
let mut movie = Movie::default();
|
||||
movie.id = i as i64;
|
||||
movie
|
||||
}).collect();
|
||||
|
||||
table.set_items(movies);
|
||||
|
||||
// Try to select an arbitrary index
|
||||
if index < list_size {
|
||||
table.select_index(Some(index));
|
||||
let selected = table.current_selection();
|
||||
prop_assert_eq!(selected.id, index as i64);
|
||||
} else {
|
||||
// Out of bounds selection should be safe
|
||||
table.select_index(Some(index));
|
||||
// Should not panic, selection stays valid
|
||||
}
|
||||
}
|
||||
|
||||
/// Property test: Table state remains consistent after scroll operations
|
||||
#[test]
|
||||
fn test_table_scroll_consistency(
|
||||
list_size in list_size(),
|
||||
scroll_amount in 0usize..20
|
||||
) {
|
||||
let mut table = StatefulTable::<Movie>::default();
|
||||
let movies: Vec<Movie> = (0..list_size).map(|i| {
|
||||
let mut movie = Movie::default();
|
||||
movie.id = i as i64;
|
||||
movie
|
||||
}).collect();
|
||||
|
||||
table.set_items(movies);
|
||||
let initial_id = table.current_selection().id;
|
||||
|
||||
// Scroll down multiple times
|
||||
for _ in 0..scroll_amount {
|
||||
table.scroll_down();
|
||||
}
|
||||
let after_down_id = table.current_selection().id;
|
||||
|
||||
// Position should increase (up to max)
|
||||
prop_assert!(after_down_id >= initial_id);
|
||||
prop_assert!(after_down_id < list_size as i64);
|
||||
|
||||
// Scroll back up
|
||||
for _ in 0..scroll_amount {
|
||||
table.scroll_up();
|
||||
}
|
||||
|
||||
// Should return to initial position (or 0 if we hit the top)
|
||||
prop_assert!(table.current_selection().id <= initial_id);
|
||||
}
|
||||
|
||||
/// Property test: Empty tables handle operations gracefully
|
||||
#[test]
|
||||
fn test_empty_table_safety(_scroll_ops in 0usize..50) {
|
||||
let table = StatefulTable::<Movie>::default();
|
||||
|
||||
// Empty table operations should be safe
|
||||
prop_assert!(table.is_empty());
|
||||
prop_assert!(table.items.is_empty());
|
||||
}
|
||||
|
||||
/// Property test: Navigation operations maintain consistency
|
||||
#[test]
|
||||
fn test_navigation_consistency(pushes in 1usize..20) {
|
||||
let mut app = App::test_default();
|
||||
let initial_route = app.get_current_route();
|
||||
|
||||
// Push multiple routes
|
||||
let routes = vec![
|
||||
ActiveRadarrBlock::Movies,
|
||||
ActiveRadarrBlock::Collections,
|
||||
ActiveRadarrBlock::Downloads,
|
||||
ActiveRadarrBlock::Blocklist,
|
||||
];
|
||||
|
||||
for i in 0..pushes {
|
||||
let route = routes[i % routes.len()];
|
||||
app.push_navigation_stack(route.into());
|
||||
}
|
||||
|
||||
// Current route should be the last pushed
|
||||
let last_pushed = routes[(pushes - 1) % routes.len()];
|
||||
prop_assert_eq!(app.get_current_route(), last_pushed.into());
|
||||
|
||||
// Pop all routes
|
||||
for _ in 0..pushes {
|
||||
app.pop_navigation_stack();
|
||||
}
|
||||
|
||||
// Should return to initial route
|
||||
prop_assert_eq!(app.get_current_route(), initial_route);
|
||||
}
|
||||
|
||||
/// Property test: String input handling is safe
|
||||
#[test]
|
||||
fn test_string_input_safety(input in text_input_string()) {
|
||||
// String operations should never panic
|
||||
let _lowercase = input.to_lowercase();
|
||||
let _uppercase = input.to_uppercase();
|
||||
let _trimmed = input.trim();
|
||||
let _len = input.len();
|
||||
let _chars: Vec<char> = input.chars().collect();
|
||||
|
||||
// All operations completed without panic
|
||||
prop_assert!(true);
|
||||
}
|
||||
|
||||
/// Property test: Table maintains data integrity after operations
|
||||
#[test]
|
||||
fn test_table_data_integrity(
|
||||
list_size in 1usize..100
|
||||
) {
|
||||
let mut table = StatefulTable::<Movie>::default();
|
||||
let movies: Vec<Movie> = (0..list_size).map(|i| {
|
||||
let mut movie = Movie::default();
|
||||
movie.id = i as i64;
|
||||
movie.title = format!("Movie {}", i).into();
|
||||
movie
|
||||
}).collect();
|
||||
|
||||
table.set_items(movies.clone());
|
||||
let original_count = table.items.len();
|
||||
|
||||
// Count should remain the same after various operations
|
||||
prop_assert_eq!(table.items.len(), original_count);
|
||||
|
||||
// All original items should still be present
|
||||
for movie in &movies {
|
||||
prop_assert!(table.items.iter().any(|m| m.id == movie.id));
|
||||
}
|
||||
}
|
||||
|
||||
/// Property test: Page up/down maintains bounds
|
||||
#[test]
|
||||
fn test_page_navigation_bounds(
|
||||
list_size in list_size(),
|
||||
page_ops in 0usize..10
|
||||
) {
|
||||
let mut table = StatefulTable::<Movie>::default();
|
||||
let movies: Vec<Movie> = (0..list_size).map(|i| {
|
||||
let mut movie = Movie::default();
|
||||
movie.id = i as i64;
|
||||
movie
|
||||
}).collect();
|
||||
|
||||
table.set_items(movies);
|
||||
|
||||
// Perform page operations
|
||||
for i in 0..page_ops {
|
||||
if i % 2 == 0 {
|
||||
table.page_down();
|
||||
} else {
|
||||
table.page_up();
|
||||
}
|
||||
|
||||
// Should never exceed bounds
|
||||
let current = table.current_selection();
|
||||
prop_assert!(current.id >= 0);
|
||||
prop_assert!(current.id < list_size as i64);
|
||||
}
|
||||
}
|
||||
|
||||
/// Property test: Table filtering reduces or maintains size
|
||||
#[test]
|
||||
fn test_table_filter_size_invariant(
|
||||
list_size in list_size(),
|
||||
filter_term in text_input_string()
|
||||
) {
|
||||
let mut table = StatefulTable::<Movie>::default();
|
||||
let movies: Vec<Movie> = (0..list_size).map(|i| {
|
||||
let mut movie = Movie::default();
|
||||
movie.id = i as i64;
|
||||
movie.title = format!("Test Movie {}", i % 10).into();
|
||||
movie
|
||||
}).collect();
|
||||
|
||||
table.set_items(movies.clone());
|
||||
let original_size = table.items.len();
|
||||
|
||||
// Apply filter
|
||||
if !filter_term.is_empty() {
|
||||
let filtered: Vec<Movie> = movies.into_iter()
|
||||
.filter(|m| m.title.text.to_lowercase().contains(&filter_term.to_lowercase()))
|
||||
.collect();
|
||||
table.set_items(filtered);
|
||||
}
|
||||
|
||||
// Filtered size should be <= original
|
||||
prop_assert!(table.items.len() <= original_size);
|
||||
|
||||
// Selection should still be valid if table not empty
|
||||
if !table.items.is_empty() {
|
||||
let current = table.current_selection();
|
||||
prop_assert!(current.id >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,4 +452,40 @@ mod test_utils {
|
||||
assert!(app.should_refresh);
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_modal_present {
|
||||
($modal:expr) => {
|
||||
assert!($modal.is_some(), "Expected modal to be present");
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_modal_absent {
|
||||
($modal:expr) => {
|
||||
assert!($modal.is_none(), "Expected modal to be absent");
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_navigation_pushed {
|
||||
($app:expr, $expected_route:expr) => {
|
||||
pretty_assertions::assert_eq!(
|
||||
$app.get_current_route(),
|
||||
$expected_route,
|
||||
"Expected route to be pushed onto navigation stack"
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_navigation_popped {
|
||||
($app:expr, $expected_route:expr) => {
|
||||
pretty_assertions::assert_eq!(
|
||||
$app.get_current_route(),
|
||||
$expected_route,
|
||||
"Expected route after popping navigation stack"
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::models::radarr_models::Movie;
|
||||
use crate::models::sonarr_models::Series;
|
||||
use crate::{assert_modal_present, assert_navigation_popped};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
@@ -53,7 +56,7 @@ mod tests {
|
||||
|
||||
handle_events(DEFAULT_KEYBINDINGS.esc.key, &mut app);
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block);
|
||||
assert_navigation_popped!(app, base_block);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -70,7 +73,7 @@ mod tests {
|
||||
handle_events(DEFAULT_KEYBINDINGS.previous_servarr.key, &mut app);
|
||||
|
||||
assert_eq!(app.server_tabs.get_active_route(), left_block.into());
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
assert!(app.is_first_render);
|
||||
assert_eq!(app.error, HorizontallyScrollableText::default());
|
||||
assert!(app.cancellation_token.is_cancelled());
|
||||
@@ -83,7 +86,7 @@ mod tests {
|
||||
handle_events(DEFAULT_KEYBINDINGS.next_servarr.key, &mut app);
|
||||
|
||||
assert_eq!(app.server_tabs.get_active_route(), right_block.into());
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
assert!(app.is_first_render);
|
||||
assert_eq!(app.error, HorizontallyScrollableText::default());
|
||||
assert!(app.cancellation_token.is_cancelled());
|
||||
@@ -100,7 +103,7 @@ mod tests {
|
||||
|
||||
handle_events(DEFAULT_KEYBINDINGS.help.key, &mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_some());
|
||||
assert_modal_present!(app.keymapping_table);
|
||||
assert_eq!(
|
||||
expected_keybinding_items,
|
||||
app.keymapping_table.unwrap().items
|
||||
@@ -115,7 +118,7 @@ mod tests {
|
||||
|
||||
handle_events(DEFAULT_KEYBINDINGS.help.key, &mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_none());
|
||||
assert_modal_absent!(app.keymapping_table);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -133,7 +136,7 @@ mod tests {
|
||||
|
||||
handle_events(DEFAULT_KEYBINDINGS.help.key, &mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_none());
|
||||
assert_modal_absent!(app.keymapping_table);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -158,7 +161,7 @@ mod tests {
|
||||
|
||||
handle_events(DEFAULT_KEYBINDINGS.down.key, &mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_some());
|
||||
assert_modal_present!(app.keymapping_table);
|
||||
assert_eq!(
|
||||
&expected_selection,
|
||||
app.keymapping_table.unwrap().current_selection()
|
||||
@@ -219,7 +222,7 @@ mod tests {
|
||||
|
||||
populate_keymapping_table(&mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_some());
|
||||
assert_modal_present!(app.keymapping_table);
|
||||
assert_eq!(
|
||||
expected_keybinding_items,
|
||||
app.keymapping_table.unwrap().items
|
||||
@@ -243,7 +246,7 @@ mod tests {
|
||||
|
||||
populate_keymapping_table(&mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_some());
|
||||
assert_modal_present!(app.keymapping_table);
|
||||
assert_eq!(
|
||||
expected_keybinding_items,
|
||||
app.keymapping_table.unwrap().items
|
||||
@@ -268,7 +271,7 @@ mod tests {
|
||||
|
||||
populate_keymapping_table(&mut app);
|
||||
|
||||
assert!(app.keymapping_table.is_some());
|
||||
assert_modal_present!(app.keymapping_table);
|
||||
assert_eq!(
|
||||
expected_keybinding_items,
|
||||
app.keymapping_table.unwrap().items
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::app::App;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::KeybindingHandler;
|
||||
@@ -11,7 +12,9 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||
use crate::{assert_modal_absent, assert_navigation_popped};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
@@ -25,7 +28,7 @@ mod tests {
|
||||
KeybindingHandler::new(ESC_KEY, &mut app, ActiveKeybindingBlock::Help, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(app.keymapping_table.is_none());
|
||||
assert_modal_absent!(app.keymapping_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::blocklist::{BlocklistHandler, blocklist_sorting_options};
|
||||
@@ -30,10 +31,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(DELETE_KEY, &mut app, ActiveRadarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::DeleteBlocklistItemPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::DeleteBlocklistItemPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -54,6 +52,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_blocklist_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -73,7 +72,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Downloads.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Downloads.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Downloads.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -94,10 +93,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -122,11 +118,11 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
@@ -139,10 +135,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::BlocklistItemDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::BlocklistItemDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -186,7 +179,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -206,7 +199,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Blocklist.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Blocklist.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +210,7 @@ mod tests {
|
||||
use crate::handlers::radarr_handlers::downloads::DownloadsHandler;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -240,7 +234,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block.into());
|
||||
assert_navigation_popped!(app, base_block.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -258,7 +252,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Blocklist.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Blocklist.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -271,7 +265,7 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Blocklist.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Blocklist.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -283,6 +277,7 @@ mod tests {
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
#[test]
|
||||
fn test_refresh_blocklist_key() {
|
||||
@@ -298,7 +293,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Blocklist.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Blocklist.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -334,10 +329,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::BlocklistClearAllItemsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::BlocklistClearAllItemsPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -392,7 +384,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::collections::collection_details_handler::CollectionDetailsHandler;
|
||||
@@ -15,12 +16,12 @@ mod tests {
|
||||
};
|
||||
|
||||
mod test_handle_submit {
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::models::BlockSelectionState;
|
||||
use crate::models::radarr_models::Movie;
|
||||
use crate::models::servarr_data::radarr::radarr_data::ADD_MOVIE_SELECTION_BLOCKS;
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -51,8 +52,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
(
|
||||
ActiveRadarrBlock::AddMoviePrompt,
|
||||
Some(ActiveRadarrBlock::CollectionDetails)
|
||||
@@ -132,7 +133,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::CollectionDetails.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.add_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.add_movie_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -157,15 +158,13 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::ViewMovieOverview.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::ViewMovieOverview.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -191,10 +190,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
assert!(app.data.radarr_data.collection_movies.items.is_empty());
|
||||
}
|
||||
|
||||
@@ -212,10 +208,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::CollectionDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::CollectionDetails.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +263,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::CollectionDetails.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.edit_collection_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_collection_modal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::collections::{
|
||||
@@ -25,6 +27,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_collections_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -44,7 +47,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Movies.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -65,7 +68,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Downloads.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Downloads.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Downloads.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -97,9 +100,9 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -116,10 +119,7 @@ mod tests {
|
||||
|
||||
CollectionsHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::Collections, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::CollectionDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::CollectionDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -166,10 +166,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::UpdateCollections)
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -193,17 +190,14 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -224,10 +218,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -242,8 +233,7 @@ mod tests {
|
||||
|
||||
CollectionsHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::Collections, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_popped!(app,
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -261,7 +251,7 @@ mod tests {
|
||||
EDIT_COLLECTION_SELECTION_BLOCKS, RadarrData,
|
||||
};
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use crate::test_edit_collection_key;
|
||||
use crate::{assert_navigation_popped, test_edit_collection_key};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -298,7 +288,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.edit_collection_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_collection_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -318,10 +308,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::UpdateAllCollectionsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::UpdateAllCollectionsPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -367,8 +354,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(app,
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert!(app.should_refresh);
|
||||
@@ -424,10 +410,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::UpdateCollections)
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::collections::edit_collection_handler::EditCollectionHandler;
|
||||
@@ -443,13 +445,13 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::radarr::modals::EditCollectionModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::EDIT_COLLECTION_SELECTION_BLOCKS;
|
||||
use crate::models::{BlockSelectionState, Route};
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -486,10 +488,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditCollectionPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditCollectionPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -514,10 +513,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -571,16 +567,13 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::EditCollection(expected_edit_collection_params))
|
||||
);
|
||||
assert!(app.should_refresh);
|
||||
assert!(app.data.radarr_data.edit_collection_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_collection_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -755,8 +748,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
(selected_block, Some(ActiveRadarrBlock::Collections)).into()
|
||||
);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
@@ -788,10 +781,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditCollectionPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditCollectionPrompt.into());
|
||||
|
||||
if active_radarr_block == ActiveRadarrBlock::EditCollectionRootFolderPathInput {
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
@@ -800,11 +790,11 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
|
||||
use super::*;
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
@@ -827,10 +817,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditCollectionPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditCollectionPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -848,13 +835,10 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
let radarr_data = &app.data.radarr_data;
|
||||
|
||||
assert!(radarr_data.edit_collection_modal.is_none());
|
||||
assert_modal_absent!(radarr_data.edit_collection_modal);
|
||||
assert!(!radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -875,16 +859,14 @@ mod tests {
|
||||
|
||||
EditCollectionHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState,
|
||||
servarr_data::radarr::{
|
||||
@@ -998,16 +980,13 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Collections.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::EditCollection(expected_edit_collection_params))
|
||||
);
|
||||
assert!(app.should_refresh);
|
||||
assert!(app.data.radarr_data.edit_collection_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_collection_modal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,7 +1061,7 @@ mod tests {
|
||||
.build_edit_collection_params();
|
||||
|
||||
assert_eq!(edit_collection_params, expected_edit_collection_params);
|
||||
assert!(app.data.radarr_data.edit_collection_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_collection_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::downloads::DownloadsHandler;
|
||||
@@ -31,10 +32,7 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(DELETE_KEY, &mut app, ActiveRadarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::DeleteDownloadPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::DeleteDownloadPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -78,10 +76,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Collections.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -102,7 +97,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Blocklist.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Blocklist.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Blocklist.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -133,6 +128,7 @@ mod tests {
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
|
||||
@@ -169,7 +165,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -192,7 +188,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +197,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -218,7 +215,7 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block.into());
|
||||
assert_navigation_popped!(app, base_block.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -232,17 +229,17 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Downloads.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Downloads.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
@@ -262,10 +259,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::UpdateDownloadsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::UpdateDownloadsPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -308,7 +302,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Downloads.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Downloads.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -373,7 +367,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::indexers::edit_indexer_handler::EditIndexerHandler;
|
||||
@@ -850,6 +853,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::app::App;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::{
|
||||
BlockSelectionState, servarr_data::radarr::radarr_data::EDIT_INDEXER_TORRENT_SELECTION_BLOCKS,
|
||||
@@ -882,7 +886,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert!(!app.should_refresh);
|
||||
assert_eq!(app.data.radarr_data.edit_indexer_modal, None);
|
||||
@@ -936,8 +940,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert!(app.data.radarr_data.edit_indexer_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_indexer_modal);
|
||||
assert!(app.should_refresh);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
@@ -966,7 +970,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.edit_indexer_modal.is_some());
|
||||
assert_modal_present!(app.data.radarr_data.edit_indexer_modal);
|
||||
assert!(!app.should_refresh);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
@@ -1002,7 +1006,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), block.into());
|
||||
assert_navigation_pushed!(app, block.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
@@ -1024,10 +1028,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPriorityInput.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::EditIndexerPriorityInput.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
@@ -1234,10 +1235,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1272,10 +1270,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1310,10 +1305,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1348,10 +1340,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1386,10 +1375,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1398,6 +1384,7 @@ mod tests {
|
||||
use crate::app::App;
|
||||
use crate::event::Key;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -1419,7 +1406,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.edit_indexer_modal, None);
|
||||
}
|
||||
@@ -1444,7 +1431,7 @@ mod tests {
|
||||
|
||||
EditIndexerHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.edit_indexer_modal,
|
||||
@@ -1454,15 +1441,15 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::app::App;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::BlockSelectionState;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::EDIT_INDEXER_TORRENT_SELECTION_BLOCKS;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_edit_indexer_name_input_backspace() {
|
||||
let mut app = App::test_default();
|
||||
@@ -1795,8 +1782,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert!(app.data.radarr_data.edit_indexer_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_indexer_modal);
|
||||
assert!(app.should_refresh);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
@@ -1874,7 +1861,7 @@ mod tests {
|
||||
.build_edit_indexer_params();
|
||||
|
||||
assert_eq!(edit_indexer_params, expected_edit_indexer_params);
|
||||
assert!(app.data.radarr_data.edit_indexer_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_indexer_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::indexers::edit_indexer_settings_handler::IndexerSettingsHandler;
|
||||
@@ -424,6 +426,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState, radarr_models::IndexerSettings,
|
||||
servarr_data::radarr::radarr_data::INDEXER_SETTINGS_SELECTION_BLOCKS,
|
||||
@@ -457,7 +460,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert!(!app.should_refresh);
|
||||
assert_eq!(app.data.radarr_data.indexer_settings, None);
|
||||
@@ -486,12 +489,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::EditAllIndexerSettings(indexer_settings()))
|
||||
);
|
||||
assert!(app.data.radarr_data.indexer_settings.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.indexer_settings);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -549,7 +552,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), selected_block.into());
|
||||
assert_navigation_pushed!(app, selected_block.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -599,8 +602,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput.into()
|
||||
);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
@@ -747,10 +750,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AllIndexerSettingsPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AllIndexerSettingsPrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -771,10 +771,7 @@ mod tests {
|
||||
|
||||
IndexerSettingsHandler::new(SUBMIT_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AllIndexerSettingsPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AllIndexerSettingsPrompt.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,6 +782,7 @@ mod tests {
|
||||
use crate::models::radarr_models::IndexerSettings;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -804,7 +802,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.indexer_settings, None);
|
||||
}
|
||||
@@ -827,7 +825,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.indexer_settings,
|
||||
@@ -854,7 +852,7 @@ mod tests {
|
||||
|
||||
IndexerSettingsHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.indexer_settings,
|
||||
Some(IndexerSettings::default())
|
||||
@@ -866,6 +864,7 @@ mod tests {
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState, radarr_models::IndexerSettings,
|
||||
servarr_data::radarr::radarr_data::INDEXER_SETTINGS_SELECTION_BLOCKS,
|
||||
@@ -952,12 +951,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::EditAllIndexerSettings(indexer_settings()))
|
||||
);
|
||||
assert!(app.data.radarr_data.indexer_settings.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.indexer_settings);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
}
|
||||
@@ -1006,7 +1005,7 @@ mod tests {
|
||||
.build_edit_indexer_settings_body();
|
||||
|
||||
assert_eq!(body, indexer_settings());
|
||||
assert!(app.data.radarr_data.indexer_settings.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.indexer_settings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::indexers::IndexersHandler;
|
||||
@@ -34,10 +35,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(DELETE_KEY, &mut app, ActiveRadarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::DeleteIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::DeleteIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -81,10 +79,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -105,7 +100,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::System.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -125,6 +120,8 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::indexer;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{
|
||||
@@ -136,8 +133,6 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::{Number, Value};
|
||||
|
||||
use super::*;
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
|
||||
#[rstest]
|
||||
@@ -196,10 +191,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::EditIndexerPrompt.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.edit_indexer_modal,
|
||||
Some((&app.data.radarr_data).into())
|
||||
@@ -259,7 +251,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::DeleteIndexer(1))
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -283,7 +275,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +283,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -310,7 +303,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -324,7 +317,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::TestIndexer, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.radarr_data.indexer_test_errors, None);
|
||||
}
|
||||
|
||||
@@ -338,7 +331,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -349,6 +342,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::indexer;
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::servarr_data::radarr::radarr_data::INDEXER_SETTINGS_SELECTION_BLOCKS,
|
||||
network::radarr_network::RadarrEvent,
|
||||
};
|
||||
@@ -371,7 +365,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -415,10 +409,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AllIndexerSettingsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::AllIndexerSettingsPrompt.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.selected_block.blocks,
|
||||
INDEXER_SETTINGS_SELECTION_BLOCKS
|
||||
@@ -464,10 +455,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::TestIndexer.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::TestIndexer.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -509,10 +497,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::TestAllIndexers.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::TestAllIndexers.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -557,7 +542,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::DeleteIndexer(1))
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::indexers::test_all_indexers_handler::TestAllIndexersHandler;
|
||||
use crate::models::servarr_data::modals::IndexerTestResultModalItem;
|
||||
@@ -12,7 +14,9 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::{assert_modal_absent, assert_navigation_popped};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -32,9 +36,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert!(app.data.radarr_data.indexer_test_all_results.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.indexer_test_all_results);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::add_movie_search_result;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use pretty_assertions::assert_str_eq;
|
||||
@@ -761,10 +764,7 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::{
|
||||
add_movie_body, add_movie_search_result, collection_movie,
|
||||
};
|
||||
@@ -774,6 +774,9 @@ mod tests {
|
||||
use crate::models::servarr_data::radarr::radarr_data::ADD_MOVIE_SELECTION_BLOCKS;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -847,7 +850,7 @@ mod tests {
|
||||
app.data.radarr_data.selected_block.get_active_block(),
|
||||
ActiveRadarrBlock::AddMovieSelectRootFolder
|
||||
);
|
||||
assert!(app.data.radarr_data.add_movie_modal.is_some());
|
||||
assert_modal_present!(app.data.radarr_data.add_movie_modal);
|
||||
assert!(
|
||||
!app
|
||||
.data
|
||||
@@ -914,7 +917,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMovieSearchResults.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.add_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.add_movie_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -981,7 +984,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -1055,12 +1058,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::AddMovie(add_movie_body()))
|
||||
);
|
||||
assert!(app.data.radarr_data.add_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.add_movie_modal);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -1092,8 +1095,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
(selected_block, Some(ActiveRadarrBlock::CollectionDetails)).into()
|
||||
);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
@@ -1126,10 +1129,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AddMoviePrompt.into());
|
||||
|
||||
if active_radarr_block == ActiveRadarrBlock::AddMovieTagsInput {
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
@@ -1144,9 +1144,10 @@ mod tests {
|
||||
use crate::models::servarr_data::radarr::modals::AddMovieModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::simple_stateful_iterable_vec;
|
||||
use crate::{assert_navigation_popped, simple_stateful_iterable_vec};
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -1167,7 +1168,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(app.data.radarr_data.add_movie_search, None);
|
||||
}
|
||||
|
||||
@@ -1188,10 +1189,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AddMoviePrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -1214,11 +1212,8 @@ mod tests {
|
||||
|
||||
AddMovieHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMovieSearchInput.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.add_searched_movies.is_none());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AddMovieSearchInput.into());
|
||||
assert_modal_absent!(app.data.radarr_data.add_searched_movies);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
@@ -1237,10 +1232,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMovieSearchResults.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AddMovieSearchResults.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1254,11 +1246,8 @@ mod tests {
|
||||
AddMovieHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::AddMoviePrompt, None).handle();
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMovieSearchResults.into()
|
||||
);
|
||||
assert!(app.data.radarr_data.add_movie_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AddMovieSearchResults.into());
|
||||
assert_modal_absent!(app.data.radarr_data.add_movie_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1278,10 +1267,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::AddMoviePrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -1318,8 +1304,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_popped!(
|
||||
app,
|
||||
(
|
||||
ActiveRadarrBlock::AddMoviePrompt,
|
||||
Some(ActiveRadarrBlock::CollectionDetails),
|
||||
@@ -1336,6 +1322,7 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
handlers::radarr_handlers::radarr_handler_test_utils::utils::{
|
||||
add_movie_body, add_movie_search_result, collection_movie,
|
||||
},
|
||||
@@ -1509,12 +1496,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::AddMovie(add_movie_body()))
|
||||
);
|
||||
assert!(app.data.radarr_data.add_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.add_movie_modal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::library::delete_movie_handler::DeleteMovieHandler;
|
||||
@@ -88,6 +89,7 @@ mod tests {
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
|
||||
@@ -113,7 +115,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert!(!app.data.radarr_data.delete_movie_files);
|
||||
@@ -149,7 +151,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::DeleteMovie(expected_delete_movie_params))
|
||||
@@ -222,6 +224,7 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -245,7 +248,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert!(!app.data.radarr_data.delete_movie_files);
|
||||
assert!(!app.data.radarr_data.add_list_exclusion);
|
||||
@@ -254,6 +257,7 @@ mod tests {
|
||||
|
||||
mod test_handle_key_char {
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState, servarr_data::radarr::radarr_data::DELETE_MOVIE_SELECTION_BLOCKS,
|
||||
},
|
||||
@@ -291,7 +295,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::DeleteMovie(expected_delete_movie_params))
|
||||
|
||||
@@ -7,6 +7,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::library::edit_movie_handler::EditMovieHandler;
|
||||
@@ -534,13 +536,13 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::radarr::modals::EditMovieModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::EDIT_MOVIE_SELECTION_BLOCKS;
|
||||
use crate::models::{BlockSelectionState, Route};
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -577,10 +579,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditMoviePrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -614,10 +613,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditMoviePrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -641,7 +637,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -694,12 +690,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::EditMovie(expected_edit_movie_params))
|
||||
);
|
||||
assert!(app.data.radarr_data.edit_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_movie_modal);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -809,8 +805,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
(selected_block, Some(ActiveRadarrBlock::Movies)).into()
|
||||
);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
@@ -882,10 +878,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditMoviePrompt.into());
|
||||
|
||||
if active_radarr_block == ActiveRadarrBlock::EditMoviePathInput
|
||||
|| active_radarr_block == ActiveRadarrBlock::EditMovieTagsInput
|
||||
@@ -896,11 +889,11 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::radarr::modals::EditMovieModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -923,10 +916,7 @@ mod tests {
|
||||
EditMovieHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::EditMoviePrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::EditMoviePrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -938,9 +928,9 @@ mod tests {
|
||||
|
||||
EditMovieHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::EditMoviePrompt, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
|
||||
assert!(app.data.radarr_data.edit_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_movie_modal);
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -960,13 +950,14 @@ mod tests {
|
||||
|
||||
EditMovieHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState,
|
||||
servarr_data::radarr::{modals::EditMovieModal, radarr_data::EDIT_MOVIE_SELECTION_BLOCKS},
|
||||
@@ -1132,12 +1123,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::EditMovie(expected_edit_movie_params))
|
||||
);
|
||||
assert!(app.data.radarr_data.edit_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_movie_modal);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
}
|
||||
@@ -1213,7 +1204,7 @@ mod tests {
|
||||
.build_edit_movie_params();
|
||||
|
||||
assert_eq!(edit_movie_params, expected_edit_movie_params);
|
||||
assert!(app.data.radarr_data.edit_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_movie_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -7,6 +7,9 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::library::{LibraryHandler, movies_sorting_options};
|
||||
@@ -72,6 +75,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_movie_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -91,7 +95,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::System.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -112,10 +116,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::Collections.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Collections.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -147,9 +148,9 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -166,10 +167,7 @@ mod tests {
|
||||
|
||||
LibraryHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::Movies, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::MovieDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::MovieDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -213,7 +211,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::UpdateAllMovies)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -237,7 +235,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,6 +247,7 @@ mod tests {
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -267,7 +266,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -289,7 +288,7 @@ mod tests {
|
||||
|
||||
LibraryHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::Movies, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -307,7 +306,7 @@ mod tests {
|
||||
};
|
||||
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use crate::test_edit_movie_key;
|
||||
use crate::{assert_navigation_popped, test_edit_movie_key};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -328,12 +327,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddMovieSearchInput.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::AddMovieSearchInput.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.add_movie_search.is_some());
|
||||
assert_modal_present!(app.data.radarr_data.add_movie_search);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -357,7 +353,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.add_movie_search.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.add_movie_search);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -389,7 +385,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(app.data.radarr_data.edit_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_movie_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -433,7 +429,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert!(app.data.radarr_data.prompt_confirm_action.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.prompt_confirm_action);
|
||||
assert!(!app.is_routing);
|
||||
}
|
||||
|
||||
@@ -454,10 +450,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::UpdateAllMoviesPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::UpdateAllMoviesPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -500,7 +493,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -551,7 +544,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::UpdateAllMovies)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::library::movie_details_handler::{
|
||||
@@ -294,7 +296,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
app.data.radarr_data.movie_info_tabs.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
MovieDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None).handle();
|
||||
|
||||
@@ -302,16 +304,16 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
app.data.radarr_data.movie_info_tabs.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -333,10 +335,7 @@ mod tests {
|
||||
MovieDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::ManualSearch, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::ManualSearchConfirmPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::ManualSearchConfirmPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -393,10 +392,7 @@ mod tests {
|
||||
MovieDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::MovieDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::MovieDetails.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
@@ -423,10 +419,7 @@ mod tests {
|
||||
MovieDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::MovieDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::MovieDetails.into());
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
}
|
||||
@@ -435,10 +428,11 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_movie_info_tabs_reset;
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
use crate::{assert_movie_info_tabs_reset, assert_navigation_popped};
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -463,7 +457,7 @@ mod tests {
|
||||
|
||||
MovieDetailsHandler::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_movie_info_tabs_reset!(app.data.radarr_data);
|
||||
}
|
||||
|
||||
@@ -487,7 +481,7 @@ mod tests {
|
||||
MovieDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +499,7 @@ mod tests {
|
||||
EDIT_MOVIE_SELECTION_BLOCKS, RadarrData,
|
||||
};
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use crate::test_edit_movie_key;
|
||||
use crate::{assert_navigation_popped, test_edit_movie_key};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -544,8 +538,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveRadarrBlock::AutomaticallySearchMoviePrompt.into()
|
||||
);
|
||||
}
|
||||
@@ -629,7 +623,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_radarr_block.into());
|
||||
assert!(app.data.radarr_data.edit_movie_modal.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_movie_modal);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -667,10 +661,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::UpdateAndScanPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::UpdateAndScanPrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -739,7 +730,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_radarr_block.into());
|
||||
assert_navigation_pushed!(app, active_radarr_block.into());
|
||||
assert!(app.is_routing);
|
||||
}
|
||||
|
||||
@@ -817,10 +808,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::MovieDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::MovieDetails.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
pub(in crate::handlers::radarr_handlers) mod utils {
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::radarr_models::{
|
||||
AddMovieBody, AddMovieOptions, AddMovieSearchResult, Collection, CollectionMovie,
|
||||
DownloadRecord, IndexerSettings, MediaInfo, MinimumAvailability, Movie, MovieCollection,
|
||||
@@ -10,8 +9,9 @@ pub(in crate::handlers::radarr_handlers) mod utils {
|
||||
use crate::models::servarr_models::{
|
||||
Indexer, IndexerField, Language, Quality, QualityWrapper, RootFolder,
|
||||
};
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use chrono::DateTime;
|
||||
use serde_json::{Number, json};
|
||||
use serde_json::{json, Number};
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! test_edit_movie_key {
|
||||
@@ -37,8 +37,8 @@ pub(in crate::handlers::radarr_handlers) mod utils {
|
||||
|
||||
$handler::new(DEFAULT_KEYBINDINGS.edit.key, &mut app, $block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
(ActiveRadarrBlock::EditMoviePrompt, Some($context)).into()
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -151,8 +151,8 @@ pub(in crate::handlers::radarr_handlers) mod utils {
|
||||
|
||||
$handler::new(DEFAULT_KEYBINDINGS.edit.key, &mut app, $block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
$crate::assert_navigation_pushed!(
|
||||
app,
|
||||
(ActiveRadarrBlock::EditCollectionPrompt, $context).into()
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::{RadarrHandler, handle_change_tab_left_right_keys};
|
||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||
@@ -33,7 +34,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
left_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
app.data.radarr_data.main_tabs.set_index(index);
|
||||
|
||||
@@ -43,7 +44,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
right_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -69,7 +70,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
left_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
app.data.radarr_data.main_tabs.set_index(index);
|
||||
|
||||
@@ -79,7 +80,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
right_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
||||
@@ -6,6 +6,9 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::root_folder;
|
||||
@@ -91,10 +94,7 @@ mod tests {
|
||||
|
||||
RootFoldersHandler::new(DELETE_KEY, &mut app, ActiveRadarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::DeleteRootFolderPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::DeleteRootFolderPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -124,6 +124,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_root_folders_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -143,7 +144,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Blocklist.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Blocklist.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Blocklist.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -164,7 +165,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Indexers.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -242,9 +243,9 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -281,10 +282,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::AddRootFolder(expected_add_root_folder_body))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -306,7 +304,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.prompt_confirm_action.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.prompt_confirm_action);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddRootFolderPrompt.into()
|
||||
@@ -338,10 +336,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::DeleteRootFolder(1))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -365,15 +360,13 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -394,10 +387,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -417,12 +407,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
|
||||
assert!(app.data.radarr_data.edit_root_folder.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_root_folder);
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
@@ -437,18 +424,15 @@ mod tests {
|
||||
|
||||
RootFoldersHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -469,12 +453,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::AddRootFolderPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::AddRootFolderPrompt.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.edit_root_folder.is_some());
|
||||
assert_modal_present!(app.data.radarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -501,7 +482,7 @@ mod tests {
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.edit_root_folder.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -522,10 +503,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -627,10 +605,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::DeleteRootFolder(1))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,7 +656,7 @@ mod tests {
|
||||
.build_add_root_folder_body();
|
||||
|
||||
assert_eq!(actual_add_root_folder_body, expected_add_root_folder_body);
|
||||
assert!(app.data.radarr_data.edit_root_folder.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::system::system_details_handler::SystemDetailsHandler;
|
||||
@@ -636,9 +637,9 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -652,10 +653,7 @@ mod tests {
|
||||
SystemDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::SystemTasks, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -699,10 +697,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::StartTask(RadarrTaskName::default()))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -722,10 +717,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,6 +727,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -757,7 +750,7 @@ mod tests {
|
||||
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::System.into());
|
||||
assert!(app.data.radarr_data.log_details.items.is_empty());
|
||||
}
|
||||
|
||||
@@ -775,7 +768,7 @@ mod tests {
|
||||
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -798,7 +791,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -810,7 +803,7 @@ mod tests {
|
||||
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::SystemUpdates, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -828,10 +821,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
}
|
||||
@@ -843,6 +833,7 @@ mod tests {
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
#[rstest]
|
||||
fn test_refresh_key(
|
||||
@@ -866,7 +857,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_radarr_block.into());
|
||||
assert_navigation_pushed!(app, active_radarr_block.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -921,10 +912,7 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm_action,
|
||||
Some(RadarrEvent::StartTask(RadarrTaskName::default()))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::system::SystemHandler;
|
||||
@@ -19,6 +20,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_system_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -38,7 +40,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Indexers.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -59,7 +61,7 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
ActiveRadarrBlock::Movies.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +69,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -80,7 +83,7 @@ mod tests {
|
||||
|
||||
SystemHandler::new(ESC_KEY, &mut app, ActiveRadarrBlock::System, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::System.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -118,10 +121,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemUpdates.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SystemUpdates.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -181,10 +181,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemQueuedEvents.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SystemQueuedEvents.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -245,7 +242,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::System.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -308,10 +305,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemLogs.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SystemLogs.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.log_details.items,
|
||||
app.data.radarr_data.logs.items
|
||||
@@ -380,10 +374,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::blocklist::{BlocklistHandler, blocklist_sorting_options};
|
||||
@@ -31,10 +32,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::DeleteBlocklistItemPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::DeleteBlocklistItemPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -55,6 +53,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_blocklist_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -75,7 +74,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Downloads.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Downloads.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Downloads.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -97,7 +96,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::History.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::History.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::History.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -123,11 +122,11 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
@@ -140,10 +139,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::BlocklistItemDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::BlocklistItemDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -187,7 +183,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -207,7 +203,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Blocklist.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +212,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -239,7 +236,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block.into());
|
||||
assert_navigation_popped!(app, base_block.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -257,7 +254,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Blocklist.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -270,7 +267,7 @@ mod tests {
|
||||
|
||||
BlocklistHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Blocklist.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -282,6 +279,7 @@ mod tests {
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
#[test]
|
||||
fn test_refresh_blocklist_key() {
|
||||
@@ -297,7 +295,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Blocklist.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -334,10 +332,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::BlocklistClearAllItemsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::BlocklistClearAllItemsPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -392,7 +387,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::downloads::DownloadsHandler;
|
||||
@@ -32,10 +33,7 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::DeleteDownloadPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::DeleteDownloadPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -60,6 +58,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_downloads_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -80,7 +79,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Series.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -102,7 +101,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Blocklist.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Blocklist.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -134,6 +133,7 @@ mod tests {
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
|
||||
@@ -170,7 +170,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -193,7 +193,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -219,7 +220,7 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block.into());
|
||||
assert_navigation_popped!(app, base_block.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -233,17 +234,17 @@ mod tests {
|
||||
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Downloads.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Downloads.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
@@ -264,10 +265,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::UpdateDownloadsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::UpdateDownloadsPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -310,7 +308,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Downloads.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Downloads.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -375,7 +373,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), base_route.into());
|
||||
assert_navigation_popped!(app, base_route.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::history::{HistoryHandler, history_sorting_options};
|
||||
@@ -21,6 +22,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_history_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -41,7 +43,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Blocklist.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Blocklist.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -85,10 +87,7 @@ mod tests {
|
||||
|
||||
HistoryHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::HistoryItemDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::HistoryItemDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -111,6 +110,7 @@ mod tests {
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -133,7 +133,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::History.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::History.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -161,6 +161,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[test]
|
||||
fn test_refresh_history_key() {
|
||||
@@ -176,7 +177,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::History.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::History.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::indexers::edit_indexer_handler::EditIndexerHandler;
|
||||
@@ -850,6 +853,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::app::App;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::{
|
||||
BlockSelectionState, servarr_data::sonarr::sonarr_data::EDIT_INDEXER_TORRENT_SELECTION_BLOCKS,
|
||||
@@ -882,7 +886,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert!(!app.should_refresh);
|
||||
assert_eq!(app.data.sonarr_data.edit_indexer_modal, None);
|
||||
@@ -936,8 +940,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert!(app.data.sonarr_data.edit_indexer_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_indexer_modal);
|
||||
assert!(app.should_refresh);
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
@@ -966,7 +970,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert!(app.data.sonarr_data.edit_indexer_modal.is_some());
|
||||
assert_modal_present!(app.data.sonarr_data.edit_indexer_modal);
|
||||
assert!(!app.should_refresh);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
@@ -1002,7 +1006,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), block.into());
|
||||
assert_navigation_pushed!(app, block.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
@@ -1024,10 +1028,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPriorityInput.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::EditIndexerPriorityInput.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
@@ -1234,10 +1235,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1272,10 +1270,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1310,10 +1305,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1348,10 +1340,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1386,10 +1375,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1398,6 +1384,7 @@ mod tests {
|
||||
use crate::app::App;
|
||||
use crate::event::Key;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -1419,7 +1406,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.edit_indexer_modal, None);
|
||||
}
|
||||
@@ -1444,7 +1431,7 @@ mod tests {
|
||||
|
||||
EditIndexerHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.edit_indexer_modal,
|
||||
@@ -1454,15 +1441,15 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::app::App;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::BlockSelectionState;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::EDIT_INDEXER_TORRENT_SELECTION_BLOCKS;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_edit_indexer_name_input_backspace() {
|
||||
let mut app = App::test_default();
|
||||
@@ -1795,8 +1782,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert!(app.data.sonarr_data.edit_indexer_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_indexer_modal);
|
||||
assert!(app.should_refresh);
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
@@ -1874,7 +1861,7 @@ mod tests {
|
||||
.build_edit_indexer_params();
|
||||
|
||||
assert_eq!(params, expected_edit_indexer_params);
|
||||
assert!(app.data.sonarr_data.edit_indexer_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_indexer_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::indexers::edit_indexer_settings_handler::IndexerSettingsHandler;
|
||||
@@ -237,6 +239,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState, servarr_data::sonarr::sonarr_data::INDEXER_SETTINGS_SELECTION_BLOCKS,
|
||||
sonarr_models::IndexerSettings,
|
||||
@@ -270,7 +273,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert!(!app.should_refresh);
|
||||
assert_eq!(app.data.sonarr_data.indexer_settings, None);
|
||||
@@ -299,12 +302,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::EditAllIndexerSettings(indexer_settings()))
|
||||
);
|
||||
assert!(app.data.sonarr_data.indexer_settings.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.indexer_settings);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -357,7 +360,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), selected_block.into());
|
||||
assert_navigation_pushed!(app, selected_block.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -405,10 +408,7 @@ mod tests {
|
||||
|
||||
IndexerSettingsHandler::new(SUBMIT_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AllIndexerSettingsPrompt.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +419,7 @@ mod tests {
|
||||
use crate::models::sonarr_models::IndexerSettings;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -438,7 +439,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.indexer_settings, None);
|
||||
}
|
||||
@@ -460,7 +461,7 @@ mod tests {
|
||||
|
||||
IndexerSettingsHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.indexer_settings,
|
||||
Some(IndexerSettings::default())
|
||||
@@ -470,6 +471,7 @@ mod tests {
|
||||
|
||||
mod test_handle_key_char {
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState, servarr_data::sonarr::sonarr_data::INDEXER_SETTINGS_SELECTION_BLOCKS,
|
||||
},
|
||||
@@ -501,12 +503,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::EditAllIndexerSettings(indexer_settings()))
|
||||
);
|
||||
assert!(app.data.sonarr_data.indexer_settings.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.indexer_settings);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
}
|
||||
@@ -555,7 +557,7 @@ mod tests {
|
||||
.build_edit_indexer_settings_params();
|
||||
|
||||
assert_eq!(actual_indexer_settings, indexer_settings());
|
||||
assert!(app.data.sonarr_data.indexer_settings.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.indexer_settings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::indexers::IndexersHandler;
|
||||
@@ -35,10 +36,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::DeleteIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -83,10 +81,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -108,7 +103,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::System.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -129,17 +124,17 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{
|
||||
EDIT_INDEXER_NZB_SELECTION_BLOCKS, EDIT_INDEXER_TORRENT_SELECTION_BLOCKS, SonarrData,
|
||||
};
|
||||
use crate::models::servarr_models::{Indexer, IndexerField};
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::{Number, Value};
|
||||
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
@@ -201,10 +196,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditIndexerPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.edit_indexer_modal,
|
||||
Some((&app.data.sonarr_data).into())
|
||||
@@ -265,7 +257,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DeleteIndexer(1))
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -289,7 +281,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +289,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -316,7 +309,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -330,7 +323,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::TestIndexer, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.sonarr_data.indexer_test_errors, None);
|
||||
}
|
||||
|
||||
@@ -344,7 +337,7 @@ mod tests {
|
||||
|
||||
IndexersHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -353,6 +346,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::servarr_data::sonarr::sonarr_data::INDEXER_SETTINGS_SELECTION_BLOCKS,
|
||||
network::sonarr_network::SonarrEvent,
|
||||
};
|
||||
@@ -377,7 +371,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -427,10 +421,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::AllIndexerSettingsPrompt.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.blocks,
|
||||
INDEXER_SETTINGS_SELECTION_BLOCKS
|
||||
@@ -477,10 +468,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::TestIndexer.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::TestIndexer.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -523,10 +511,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::TestAllIndexers.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::TestAllIndexers.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -571,7 +556,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DeleteIndexer(1))
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::indexers::test_all_indexers_handler::TestAllIndexersHandler;
|
||||
use crate::models::servarr_data::modals::IndexerTestResultModalItem;
|
||||
@@ -12,7 +14,9 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::{assert_modal_absent, assert_navigation_popped};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -32,9 +36,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Indexers.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(app.data.sonarr_data.indexer_test_all_results.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.indexer_test_all_results);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::add_series_handler::AddSeriesHandler;
|
||||
@@ -894,16 +897,16 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::BlockSelectionState;
|
||||
use crate::models::servarr_data::sonarr::modals::AddSeriesModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::ADD_SERIES_SELECTION_BLOCKS;
|
||||
use crate::models::sonarr_models::Series;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use bimap::BiMap;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -925,10 +928,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesSearchResults.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::AddSeriesSearchResults.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -972,15 +972,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
ActiveSonarrBlock::AddSeriesSelectRootFolder
|
||||
);
|
||||
assert!(app.data.sonarr_data.add_series_modal.is_some());
|
||||
assert_modal_present!(app.data.sonarr_data.add_series_modal);
|
||||
assert!(
|
||||
!app
|
||||
.data
|
||||
@@ -1048,7 +1045,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesSearchResults.into()
|
||||
);
|
||||
assert!(app.data.sonarr_data.add_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_series_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1091,10 +1088,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesAlreadyInLibrary.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::AddSeriesAlreadyInLibrary.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1117,7 +1111,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -1200,12 +1194,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::AddSeries(expected_add_series_body))
|
||||
);
|
||||
assert!(app.data.sonarr_data.add_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_series_modal);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -1233,7 +1227,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), selected_block.into());
|
||||
assert_navigation_pushed!(app, selected_block.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
|
||||
if selected_block == ActiveSonarrBlock::AddSeriesTagsInput {
|
||||
@@ -1260,10 +1254,7 @@ mod tests {
|
||||
|
||||
AddSeriesHandler::new(SUBMIT_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
|
||||
if active_sonarr_block == ActiveSonarrBlock::AddSeriesTagsInput {
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
@@ -1332,9 +1323,10 @@ mod tests {
|
||||
use crate::models::servarr_data::sonarr::modals::AddSeriesModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::simple_stateful_iterable_vec;
|
||||
use crate::{assert_navigation_popped, simple_stateful_iterable_vec};
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -1356,7 +1348,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(app.data.sonarr_data.add_series_search, None);
|
||||
}
|
||||
|
||||
@@ -1378,10 +1370,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -1405,11 +1394,8 @@ mod tests {
|
||||
|
||||
AddSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesSearchInput.into()
|
||||
);
|
||||
assert!(app.data.sonarr_data.add_searched_series.is_none());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesSearchInput.into());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_searched_series);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
|
||||
@@ -1429,10 +1415,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesSearchResults.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesSearchResults.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1447,11 +1430,8 @@ mod tests {
|
||||
AddSeriesHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesSearchResults.into()
|
||||
);
|
||||
assert!(app.data.sonarr_data.add_series_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesSearchResults.into());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_series_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1472,10 +1452,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -1496,16 +1473,14 @@ mod tests {
|
||||
|
||||
AddSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState,
|
||||
servarr_data::sonarr::{modals::AddSeriesModal, sonarr_data::ADD_SERIES_SELECTION_BLOCKS},
|
||||
@@ -1701,12 +1676,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::AddSeries(expected_add_series_body))
|
||||
);
|
||||
assert!(app.data.sonarr_data.add_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_series_modal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1824,7 +1799,7 @@ mod tests {
|
||||
.build_add_series_body();
|
||||
|
||||
assert_eq!(add_series_body, expected_add_series_body);
|
||||
assert!(app.data.sonarr_data.add_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_series_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::delete_series_handler::DeleteSeriesHandler;
|
||||
@@ -91,6 +92,7 @@ mod tests {
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
|
||||
@@ -117,7 +119,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(!app.data.sonarr_data.delete_series_files);
|
||||
@@ -154,7 +156,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DeleteSeries(expected_delete_series_params))
|
||||
@@ -228,6 +230,7 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -251,7 +254,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(!app.data.sonarr_data.delete_series_files);
|
||||
assert!(!app.data.sonarr_data.add_list_exclusion);
|
||||
@@ -260,6 +263,7 @@ mod tests {
|
||||
|
||||
mod test_handle_key_char {
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState, servarr_data::sonarr::sonarr_data::DELETE_SERIES_SELECTION_BLOCKS,
|
||||
},
|
||||
@@ -298,7 +302,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DeleteSeries(expected_delete_series_params))
|
||||
|
||||
@@ -7,6 +7,8 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::edit_series_handler::EditSeriesHandler;
|
||||
@@ -25,7 +27,7 @@ mod tests {
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::EDIT_SERIES_SELECTION_BLOCKS;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
#[rstest]
|
||||
fn test_edit_series_select_series_type_scroll(
|
||||
#[values(DEFAULT_KEYBINDINGS.up.key, DEFAULT_KEYBINDINGS.down.key)] key: Key,
|
||||
@@ -663,13 +665,13 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::sonarr::modals::EditSeriesModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::EDIT_SERIES_SELECTION_BLOCKS;
|
||||
use crate::models::{BlockSelectionState, Route};
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -707,10 +709,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -745,10 +744,7 @@ mod tests {
|
||||
.text
|
||||
.is_empty()
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -772,7 +768,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -834,12 +830,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::EditSeries(expected_edit_series_params))
|
||||
);
|
||||
assert!(app.data.sonarr_data.edit_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_series_modal);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -1006,8 +1002,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
(selected_block, Some(ActiveSonarrBlock::Series)).into()
|
||||
);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
@@ -1082,10 +1078,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
|
||||
if active_sonarr_block == ActiveSonarrBlock::EditSeriesPathInput
|
||||
|| active_sonarr_block == ActiveSonarrBlock::EditSeriesTagsInput
|
||||
@@ -1096,11 +1089,11 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::sonarr::modals::EditSeriesModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -1124,10 +1117,7 @@ mod tests {
|
||||
EditSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EditSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1140,9 +1130,9 @@ mod tests {
|
||||
|
||||
EditSeriesHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
|
||||
assert!(app.data.sonarr_data.edit_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_series_modal);
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -1164,13 +1154,14 @@ mod tests {
|
||||
|
||||
EditSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::{
|
||||
assert_navigation_popped,
|
||||
models::{
|
||||
BlockSelectionState,
|
||||
servarr_data::sonarr::{
|
||||
@@ -1352,12 +1343,12 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::EditSeries(expected_edit_series_params))
|
||||
);
|
||||
assert!(app.data.sonarr_data.edit_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_series_modal);
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
}
|
||||
@@ -1442,7 +1433,7 @@ mod tests {
|
||||
.build_edit_series_params();
|
||||
|
||||
assert_eq!(edit_series_params, expected_edit_series_params);
|
||||
assert!(app.data.sonarr_data.edit_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_series_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::episode_details_handler::EpisodeDetailsHandler;
|
||||
use crate::handlers::sonarr_handlers::sonarr_handler_test_utils::utils::episode;
|
||||
@@ -103,7 +104,7 @@ mod tests {
|
||||
.episode_details_tabs
|
||||
.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
EpisodeDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
.handle();
|
||||
@@ -122,12 +123,13 @@ mod tests {
|
||||
.episode_details_tabs
|
||||
.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::event::Key;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
@@ -148,10 +150,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EpisodeHistoryDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::EpisodeHistoryDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -238,7 +237,7 @@ mod tests {
|
||||
EpisodeDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_pushed!(app, active_sonarr_block.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
@@ -262,10 +261,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::ManualEpisodeSearch.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DownloadRelease(SonarrReleaseDownloadBody {
|
||||
@@ -293,10 +289,7 @@ mod tests {
|
||||
EpisodeDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EpisodeDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EpisodeDetails.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -314,8 +307,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveSonarrBlock::ManualEpisodeSearchConfirmPrompt.into()
|
||||
);
|
||||
}
|
||||
@@ -344,6 +337,7 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::event::Key;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@@ -364,10 +358,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EpisodeHistory.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EpisodeHistory.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -389,10 +380,7 @@ mod tests {
|
||||
EpisodeDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EpisodeDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::EpisodeDetails.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -412,10 +400,7 @@ mod tests {
|
||||
|
||||
EpisodeDetailsHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeasonDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeasonDetails.into());
|
||||
assert!(
|
||||
app
|
||||
.data
|
||||
@@ -431,6 +416,7 @@ mod tests {
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -457,8 +443,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveSonarrBlock::AutomaticallySearchEpisodePrompt.into()
|
||||
);
|
||||
}
|
||||
@@ -511,7 +497,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_pushed!(app, active_sonarr_block.into());
|
||||
assert!(app.is_routing);
|
||||
}
|
||||
|
||||
@@ -576,7 +562,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_popped!(app, active_sonarr_block.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::TriggerAutomaticEpisodeSearch(1))
|
||||
@@ -600,10 +586,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::ManualEpisodeSearch.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DownloadRelease(SonarrReleaseDownloadBody {
|
||||
|
||||
@@ -7,6 +7,9 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::{LibraryHandler, series_sorting_options};
|
||||
@@ -71,6 +74,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_series_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -90,7 +94,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::System.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -111,7 +115,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Downloads.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Downloads.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Downloads.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -144,9 +148,9 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -163,10 +167,7 @@ mod tests {
|
||||
|
||||
LibraryHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SeriesDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -210,7 +211,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::UpdateAllSeries)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -234,7 +235,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +245,7 @@ mod tests {
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -262,7 +264,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -277,7 +279,7 @@ mod tests {
|
||||
|
||||
LibraryHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -292,7 +294,7 @@ mod tests {
|
||||
use crate::models::sonarr_models::SeriesType;
|
||||
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use crate::test_edit_series_key;
|
||||
use crate::{assert_navigation_popped, test_edit_series_key};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -313,12 +315,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddSeriesSearchInput.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::AddSeriesSearchInput.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.sonarr_data.add_series_search.is_some());
|
||||
assert_modal_present!(app.data.sonarr_data.add_series_search);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -342,7 +341,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.sonarr_data.add_series_search.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.add_series_search);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -374,7 +373,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert!(app.data.sonarr_data.edit_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_series_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -418,7 +417,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(app.data.sonarr_data.prompt_confirm_action.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.prompt_confirm_action);
|
||||
assert!(!app.is_routing);
|
||||
}
|
||||
|
||||
@@ -439,10 +438,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::UpdateAllSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -485,7 +481,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Series.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -536,7 +532,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::UpdateAllSeries)
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::season_details_handler::{
|
||||
SeasonDetailsHandler, releases_sorting_options,
|
||||
@@ -37,10 +39,7 @@ mod tests {
|
||||
SeasonDetailsHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::DeleteEpisodeFilePrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::DeleteEpisodeFilePrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -139,7 +138,7 @@ mod tests {
|
||||
.season_details_tabs
|
||||
.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
SeasonDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None).handle();
|
||||
|
||||
@@ -154,12 +153,13 @@ mod tests {
|
||||
.season_details_tabs
|
||||
.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::event::Key;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
@@ -176,10 +176,7 @@ mod tests {
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::EpisodeDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::EpisodeDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -227,10 +224,7 @@ mod tests {
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeasonHistoryDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SeasonHistoryDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -295,7 +289,7 @@ mod tests {
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_popped!(app, active_sonarr_block.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
@@ -319,10 +313,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::ManualSeasonSearch.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DownloadRelease(SonarrReleaseDownloadBody {
|
||||
@@ -352,10 +343,7 @@ mod tests {
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeasonDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeasonDetails.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
|
||||
@@ -373,8 +361,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveSonarrBlock::ManualSeasonSearchConfirmPrompt.into()
|
||||
);
|
||||
}
|
||||
@@ -403,6 +391,7 @@ mod tests {
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::event::Key;
|
||||
use crate::models::sonarr_models::SonarrHistoryItem;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
@@ -426,10 +415,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeasonHistory.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeasonHistory.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -452,10 +438,7 @@ mod tests {
|
||||
SeasonDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeasonDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeasonDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -536,16 +519,14 @@ mod tests {
|
||||
|
||||
SeasonDetailsHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesDetails.into()
|
||||
);
|
||||
assert!(app.data.sonarr_data.season_details_modal.is_none());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeriesDetails.into());
|
||||
assert_modal_absent!(app.data.sonarr_data.season_details_modal);
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -605,7 +586,7 @@ mod tests {
|
||||
ActiveSonarrBlock::SeasonDetails.into()
|
||||
);
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(app.data.sonarr_data.prompt_confirm_action.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.prompt_confirm_action);
|
||||
assert!(!app.is_routing);
|
||||
}
|
||||
|
||||
@@ -630,8 +611,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveSonarrBlock::AutomaticallySearchSeasonPrompt.into()
|
||||
);
|
||||
}
|
||||
@@ -682,7 +663,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_pushed!(app, active_sonarr_block.into());
|
||||
assert!(app.is_routing);
|
||||
}
|
||||
|
||||
@@ -743,7 +724,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_popped!(app, active_sonarr_block.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
@@ -767,10 +748,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::ManualSeasonSearch.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DownloadRelease(SonarrReleaseDownloadBody {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::library::series_details_handler::SeriesDetailsHandler;
|
||||
@@ -69,7 +71,7 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
app.data.sonarr_data.series_info_tabs.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
SeriesDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None).handle();
|
||||
|
||||
@@ -77,15 +79,15 @@ mod tests {
|
||||
app.get_current_route(),
|
||||
app.data.sonarr_data.series_info_tabs.get_active_route()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::extended_stateful_iterable_vec;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use crate::{assert_navigation_popped, extended_stateful_iterable_vec};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -103,10 +105,7 @@ mod tests {
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeasonDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SeasonDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -145,10 +144,7 @@ mod tests {
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesHistoryDetails.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SeriesHistoryDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -200,10 +196,7 @@ mod tests {
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeriesDetails.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
@@ -225,16 +218,14 @@ mod tests {
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeriesDetails.into());
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui::widgets::TableState;
|
||||
@@ -255,10 +246,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesHistory.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeriesHistory.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -279,10 +267,7 @@ mod tests {
|
||||
SeriesDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SeriesDetails.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SeriesDetails.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -343,7 +328,7 @@ mod tests {
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::sonarr_test_utils::utils::create_test_sonarr_data;
|
||||
use crate::models::sonarr_models::{Series, SeriesType};
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use crate::test_edit_series_key;
|
||||
use crate::{assert_navigation_popped, test_edit_series_key};
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
use serde_json::Number;
|
||||
use strum::IntoEnumIterator;
|
||||
@@ -378,7 +363,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert!(app.data.sonarr_data.edit_series_modal.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_series_modal);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -428,7 +413,7 @@ mod tests {
|
||||
ActiveSonarrBlock::SeriesDetails.into()
|
||||
);
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(app.data.sonarr_data.prompt_confirm_action.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.prompt_confirm_action);
|
||||
assert!(!app.is_routing);
|
||||
}
|
||||
|
||||
@@ -451,8 +436,8 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
assert_navigation_pushed!(
|
||||
app,
|
||||
ActiveSonarrBlock::AutomaticallySearchSeriesPrompt.into()
|
||||
);
|
||||
}
|
||||
@@ -496,10 +481,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::UpdateAndScanSeriesPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::UpdateAndScanSeriesPrompt.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -542,7 +524,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_pushed!(app, active_sonarr_block.into());
|
||||
assert!(app.is_routing);
|
||||
}
|
||||
|
||||
@@ -598,7 +580,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_popped!(app, active_sonarr_block.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(expected_action)
|
||||
|
||||
@@ -6,6 +6,9 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::root_folders::RootFoldersHandler;
|
||||
@@ -94,10 +97,7 @@ mod tests {
|
||||
|
||||
RootFoldersHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::DeleteRootFolderPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -127,6 +127,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_root_folders_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -147,7 +148,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::History.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::History.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::History.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -169,7 +170,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Indexers.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -254,6 +255,7 @@ mod tests {
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_modal_absent, assert_navigation_popped};
|
||||
|
||||
const SUBMIT_KEY: Key = DEFAULT_KEYBINDINGS.submit.key;
|
||||
|
||||
@@ -288,11 +290,8 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::AddRootFolder(expected_add_root_folder_body))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert!(app.data.sonarr_data.edit_root_folder.is_none());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -314,7 +313,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.sonarr_data.prompt_confirm_action.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.prompt_confirm_action);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddRootFolderPrompt.into()
|
||||
@@ -346,10 +345,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DeleteRootFolder(1))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -373,15 +369,13 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_esc {
|
||||
use super::*;
|
||||
use crate::assert_navigation_popped;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -402,10 +396,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
@@ -425,12 +416,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
|
||||
assert!(app.data.sonarr_data.edit_root_folder.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_root_folder);
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
}
|
||||
@@ -445,18 +433,15 @@ mod tests {
|
||||
|
||||
RootFoldersHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
mod test_handle_key_char {
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -478,12 +463,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::AddRootFolderPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::AddRootFolderPrompt.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.sonarr_data.edit_root_folder.is_some());
|
||||
assert_modal_present!(app.data.sonarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -510,7 +492,7 @@ mod tests {
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.sonarr_data.edit_root_folder.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -531,10 +513,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -638,10 +617,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::DeleteRootFolder(1))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::RootFolders.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::RootFolders.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,7 +688,7 @@ mod tests {
|
||||
.build_add_root_folder_body();
|
||||
|
||||
assert_eq!(root_folder, expected_add_root_folder_body);
|
||||
assert!(app.data.sonarr_data.edit_root_folder.is_none());
|
||||
assert_modal_absent!(app.data.sonarr_data.edit_root_folder);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::SonarrHandler;
|
||||
use crate::handlers::sonarr_handlers::handle_change_tab_left_right_keys;
|
||||
@@ -33,7 +34,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
left_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
app.data.sonarr_data.main_tabs.set_index(index);
|
||||
|
||||
@@ -43,7 +44,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
right_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -68,7 +69,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
left_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
assert_navigation_pushed!(app, left_block.into());
|
||||
|
||||
app.data.sonarr_data.main_tabs.set_index(index);
|
||||
|
||||
@@ -78,7 +79,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
right_block.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), right_block.into());
|
||||
assert_navigation_pushed!(app, right_block.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
||||
@@ -6,6 +6,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::system::system_details_handler::SystemDetailsHandler;
|
||||
@@ -652,9 +653,9 @@ mod tests {
|
||||
}
|
||||
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::assert_navigation_popped;
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -669,10 +670,7 @@ mod tests {
|
||||
SystemDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -717,10 +715,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::StartTask(SonarrTaskName::default()))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SystemTasks.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -740,10 +735,7 @@ mod tests {
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SystemTasks.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,6 +745,7 @@ mod tests {
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -775,7 +768,7 @@ mod tests {
|
||||
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::System.into());
|
||||
assert!(app.data.sonarr_data.log_details.items.is_empty());
|
||||
}
|
||||
|
||||
@@ -793,7 +786,7 @@ mod tests {
|
||||
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -816,7 +809,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -828,7 +821,7 @@ mod tests {
|
||||
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SystemUpdates, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -846,10 +839,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SystemTasks.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
}
|
||||
@@ -861,6 +851,7 @@ mod tests {
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
#[rstest]
|
||||
fn test_refresh_key(
|
||||
@@ -885,7 +876,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
assert_navigation_pushed!(app, active_sonarr_block.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -943,10 +934,7 @@ mod tests {
|
||||
app.data.sonarr_data.prompt_confirm_action,
|
||||
Some(SonarrEvent::StartTask(SonarrTaskName::default()))
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::SystemTasks.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ mod tests {
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::sonarr_handlers::system::SystemHandler;
|
||||
@@ -19,6 +20,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::assert_navigation_pushed;
|
||||
|
||||
#[rstest]
|
||||
fn test_system_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
@@ -39,7 +41,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Indexers.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -61,7 +63,7 @@ mod tests {
|
||||
app.data.sonarr_data.main_tabs.get_active_route(),
|
||||
ActiveSonarrBlock::Series.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +71,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -82,7 +85,7 @@ mod tests {
|
||||
|
||||
SystemHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::System, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_popped!(app, ActiveSonarrBlock::System.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -121,10 +124,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemUpdates.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SystemUpdates.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -185,10 +185,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemQueuedEvents.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SystemQueuedEvents.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -249,7 +246,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::System.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -313,10 +310,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemLogs.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SystemLogs.into());
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.log_details.items,
|
||||
app.data.sonarr_data.logs.items
|
||||
@@ -386,10 +380,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveSonarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveSonarrBlock::SystemTasks.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::app::key_binding::DEFAULT_KEYBINDINGS;
|
||||
use crate::assert_modal_absent;
|
||||
use crate::assert_modal_present;
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::table_handler::TableHandlingConfig;
|
||||
@@ -736,8 +739,8 @@ mod tests {
|
||||
mod test_handle_submit {
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
|
||||
use crate::extended_stateful_iterable_vec;
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::{assert_navigation_popped, extended_stateful_iterable_vec};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -764,7 +767,7 @@ mod tests {
|
||||
app.data.radarr_data.movies.current_selection().title.text,
|
||||
"Test 2"
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -788,10 +791,7 @@ mod tests {
|
||||
app.data.radarr_data.movies.current_selection().title.text,
|
||||
"Test 1"
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SearchMovieError.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SearchMovieError.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -820,7 +820,7 @@ mod tests {
|
||||
app.data.radarr_data.movies.current_selection().title.text,
|
||||
"Test 2"
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -840,7 +840,7 @@ mod tests {
|
||||
|
||||
TableHandlerUnit::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::FilterMovies, None).handle();
|
||||
|
||||
assert!(app.data.radarr_data.movies.filtered_items.is_some());
|
||||
assert_modal_present!(app.data.radarr_data.movies.filtered_items);
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app
|
||||
@@ -857,7 +857,7 @@ mod tests {
|
||||
app.data.radarr_data.movies.current_selection().title.text,
|
||||
"Test 1"
|
||||
);
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -878,11 +878,8 @@ mod tests {
|
||||
TableHandlerUnit::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::FilterMovies, None).handle();
|
||||
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.movies.filtered_items.is_none());
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::FilterMoviesError.into()
|
||||
);
|
||||
assert_modal_absent!(app.data.radarr_data.movies.filtered_items);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterMoviesError.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -906,7 +903,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(app.data.radarr_data.movies.items, expected_vec);
|
||||
}
|
||||
}
|
||||
@@ -919,6 +916,7 @@ mod tests {
|
||||
use crate::models::stateful_table::StatefulTable;
|
||||
|
||||
use super::*;
|
||||
use crate::{assert_navigation_popped, assert_navigation_pushed};
|
||||
|
||||
const ESC_KEY: Key = DEFAULT_KEYBINDINGS.esc.key;
|
||||
|
||||
@@ -936,7 +934,7 @@ mod tests {
|
||||
|
||||
TableHandlerUnit::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(app.data.radarr_data.movies.search, None);
|
||||
}
|
||||
@@ -965,7 +963,7 @@ mod tests {
|
||||
|
||||
TableHandlerUnit::new(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(app.data.radarr_data.movies.filter, None);
|
||||
assert_eq!(app.data.radarr_data.movies.filtered_items, None);
|
||||
@@ -981,7 +979,7 @@ mod tests {
|
||||
|
||||
TableHandlerUnit::new(ESC_KEY, &mut app, ActiveRadarrBlock::MoviesSortPrompt, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1033,10 +1031,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::SearchMovie.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SearchMovie.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.movies.search,
|
||||
@@ -1107,12 +1102,9 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::FilterMovies.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterMovies.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.movies.filter.is_some());
|
||||
assert_modal_present!(app.data.radarr_data.movies.filter);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1136,7 +1128,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(!app.ignore_special_keys_for_textbox_input);
|
||||
assert!(app.data.radarr_data.movies.filter.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.movies.filter);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1160,17 +1152,14 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::FilterMovies.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterMovies.into());
|
||||
assert!(app.ignore_special_keys_for_textbox_input);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.movies.filter,
|
||||
Some(HorizontallyScrollableText::default())
|
||||
);
|
||||
assert!(app.data.radarr_data.movies.filtered_items.is_none());
|
||||
assert!(app.data.radarr_data.movies.filtered_state.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.movies.filtered_items);
|
||||
assert_modal_absent!(app.data.radarr_data.movies.filtered_state);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1312,10 +1301,7 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveRadarrBlock::MoviesSortPrompt.into()
|
||||
);
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::MoviesSortPrompt.into());
|
||||
assert_eq!(
|
||||
app.data.radarr_data.movies.sort.as_ref().unwrap().items,
|
||||
sort_options()
|
||||
@@ -1343,7 +1329,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(app.data.radarr_data.movies.sort.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.movies.sort);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1364,7 +1350,7 @@ mod tests {
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
assert!(app.data.radarr_data.movies.sort.is_none());
|
||||
assert_modal_absent!(app.data.radarr_data.movies.sort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user