test: Added in unit tests for TUI support for multiple custom named Servarrs
This commit is contained in:
@@ -28,7 +28,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_collections_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app.data.radarr_data.main_tabs.set_index(1);
|
||||
|
||||
@@ -49,7 +49,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_collections_tab_right(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app.data.radarr_data.main_tabs.set_index(1);
|
||||
|
||||
@@ -72,7 +72,7 @@ mod tests {
|
||||
fn test_left_right_update_all_collections_prompt_toggle(
|
||||
#[values(DEFAULT_KEYBINDINGS.left.key, DEFAULT_KEYBINDINGS.right.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
|
||||
CollectionsHandler::new(
|
||||
key,
|
||||
@@ -107,7 +107,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collections_submit() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -124,7 +124,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collections_submit_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app
|
||||
@@ -143,7 +143,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_all_collections_prompt_confirm_submit() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -174,7 +174,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_all_collections_prompt_decline_submit() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -211,7 +211,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_all_collections_prompt_block_esc() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::UpdateAllCollectionsPrompt.into());
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
@@ -233,7 +233,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_default_esc(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app.error = "test error".to_owned().into();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
@@ -272,7 +272,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collection_edit_key_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
let mut radarr_data = create_test_radarr_data();
|
||||
@@ -303,7 +303,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -326,7 +326,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_key_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app
|
||||
@@ -351,7 +351,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_refresh_collections_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app
|
||||
.data
|
||||
@@ -376,7 +376,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_refresh_collections_key_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app
|
||||
@@ -402,7 +402,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_all_collections_prompt_confirm_confirm() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
@@ -591,7 +591,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collections_handler_not_ready_when_loading() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = CollectionsHandler::new(
|
||||
@@ -606,7 +606,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collections_handler_not_ready_when_collections_is_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = CollectionsHandler::new(
|
||||
@@ -621,7 +621,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collections_handler_ready_when_not_loading_and_collections_is_not_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = false;
|
||||
app
|
||||
.data
|
||||
|
||||
Reference in New Issue
Block a user