Refactored the ErrorMessage widget into a generic Message widget for enhanced reuse. Added support for testing a single indexer at a time.
This commit is contained in:
@@ -312,6 +312,19 @@ mod tests {
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_test_indexer_esc() {
|
||||
let mut app = App::default();
|
||||
app.data.radarr_data.indexer_test_error = Some("test result".to_owned());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::TestIndexer.into());
|
||||
|
||||
IndexersHandler::with(&ESC_KEY, &mut app, &ActiveRadarrBlock::TestIndexer, &None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.radarr_data.indexer_test_error, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_esc() {
|
||||
let mut app = App::default();
|
||||
@@ -391,6 +404,24 @@ mod tests {
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::TestIndexer.into()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_test_all_key() {
|
||||
let mut app = App::default();
|
||||
|
||||
IndexersHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.test_all.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::Indexers,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::TestAllIndexers.into()
|
||||
|
||||
Reference in New Issue
Block a user