diff options
Diffstat (limited to 'src/interactive/app/tests/unit.rs')
-rw-r--r-- | src/interactive/app/tests/unit.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/interactive/app/tests/unit.rs b/src/interactive/app/tests/unit.rs new file mode 100644 index 0000000..3032e4f --- /dev/null +++ b/src/interactive/app/tests/unit.rs @@ -0,0 +1,31 @@ +use crate::interactive::app::tests::utils::{ + debug, initialized_app_and_terminal_from_fixture, sample_01_tree, sample_02_tree, +}; +use anyhow::Result; +use pretty_assertions::assert_eq; + +#[test] +fn it_can_handle_ending_traversal_reaching_top_but_skipping_levels() -> Result<()> { + let (_, app) = initialized_app_and_terminal_from_fixture(&["sample-01"])?; + let expected_tree = sample_01_tree(); + + assert_eq!( + debug(app.traversal.tree), + debug(expected_tree), + "filesystem graph is stable and matches the directory structure" + ); + Ok(()) +} + +#[test] +fn it_can_handle_ending_traversal_without_reaching_the_top() -> Result<()> { + let (_, app) = initialized_app_and_terminal_from_fixture(&["sample-02"])?; + let expected_tree = sample_02_tree(); + + assert_eq!( + debug(app.traversal.tree), + debug(expected_tree), + "filesystem graph is stable and matches the directory structure" + ); + Ok(()) +} |