refactor: Created dedicated proptests and assertions to clean up the handler unit tests
This commit is contained in:
1 parent
35dce0bf01
commit
49fd086b92
46 files changed
+1023
-1018
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user