Added Makefile and tests for the main radarr_handler

This commit is contained in:
2023-08-08 10:50:05 -06:00
parent c15bda5885
commit befd4bc15a
3 changed files with 722 additions and 46 deletions
+4 -34
View File
@@ -82,6 +82,8 @@ macro_rules! handle_text_box_keys {
#[cfg(test)]
mod tests {
use rstest::rstest;
use crate::app::App;
use crate::event::Key;
use crate::handlers::{handle_clear_errors, handle_prompt_toggle};
@@ -132,10 +134,9 @@ mod tests {
assert!(app.error.text.is_empty());
}
#[test]
fn test_handle_prompt_toggle_left() {
#[rstest]
fn test_handle_prompt_toggle_left_right(#[values(Key::Left, Key::Right)] key: Key) {
let mut app = App::default();
let key = Key::Left;
assert!(!app.data.radarr_data.prompt_confirm);
@@ -147,35 +148,4 @@ mod tests {
assert!(!app.data.radarr_data.prompt_confirm);
}
#[test]
fn test_handle_prompt_toggle_right() {
let mut app = App::default();
let key = Key::Right;
assert!(!app.data.radarr_data.prompt_confirm);
handle_prompt_toggle(&mut app, &key);
assert!(app.data.radarr_data.prompt_confirm);
handle_prompt_toggle(&mut app, &key);
assert!(!app.data.radarr_data.prompt_confirm);
}
#[test]
fn test_handle_prompt_toggle_left_and_right_are_inverses() {
let mut app = App::default();
assert!(!app.data.radarr_data.prompt_confirm);
handle_prompt_toggle(&mut app, &Key::Left);
assert!(app.data.radarr_data.prompt_confirm);
handle_prompt_toggle(&mut app, &Key::Right);
assert!(!app.data.radarr_data.prompt_confirm);
}
}