From 80bce4be7e7002edb28665ec9111587aa6deef8b Mon Sep 17 00:00:00 2001 From: Jerry Kingsbury Date: Mon, 5 May 2025 16:29:34 -0500 Subject: [PATCH] test(workspace): move window to non existent container Created a test for moving a window to a container that doesn't exist. The test ensures that we receive an error when moving a window to a container that doesn't exist. --- komorebi/src/workspace.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index fe97a111..10f980df 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -2291,6 +2291,25 @@ mod tests { assert_eq!(container.windows().len(), 1); } + #[test] + fn test_move_window_to_non_existent_container() { + let mut workspace = Workspace::default(); + + // Add a container with one window + let mut container = Container::default(); + container.windows_mut().push_back(Window::from(1)); + workspace.add_container_to_back(container); + + // Try to move window to a non-existent container + let result = workspace.move_window_to_container(8); + + // Should return an error + assert!( + result.is_err(), + "Expected an error when moving a window to a non-existent container" + ); + } + #[test] fn test_remove_window() { let mut workspace = Workspace::default();