summaryrefslogtreecommitdiffstats
path: root/src/interactive/app/tests/journeys_readonly.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/interactive/app/tests/journeys_readonly.rs')
-rw-r--r--src/interactive/app/tests/journeys_readonly.rs37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/interactive/app/tests/journeys_readonly.rs b/src/interactive/app/tests/journeys_readonly.rs
index 9bb4e27..7a1df0e 100644
--- a/src/interactive/app/tests/journeys_readonly.rs
+++ b/src/interactive/app/tests/journeys_readonly.rs
@@ -67,29 +67,36 @@ fn simple_user_journey_read_only() -> Result<()> {
app.process_events(&mut terminal, into_keys(b"m".iter()))?;
assert_eq!(
app.state.sorting,
- SortMode::MTimeAscending,
+ SortMode::MTimeDescending,
"it sets the sort mode to descending by mtime"
);
// when hitting the M key again
app.process_events(&mut terminal, into_keys(b"m".iter()))?;
assert_eq!(
app.state.sorting,
- SortMode::MTimeDescending,
+ SortMode::MTimeAscending,
"it sets the sort mode to ascending by mtime"
);
- // when hitting the S key
- app.process_events(&mut terminal, into_keys(b"s".iter()))?;
+ // when hitting the C key
+ app.process_events(&mut terminal, into_keys(b"c".iter()))?;
assert_eq!(
app.state.sorting,
- SortMode::SizeAscending,
- "it sets the sort mode to ascending by size"
+ SortMode::CountDescending,
+ "it sets the sort mode to descending by count"
+ );
+ // when hitting the C key again
+ app.process_events(&mut terminal, into_keys(b"c".iter()))?;
+ assert_eq!(
+ app.state.sorting,
+ SortMode::CountAscending,
+ "it sets the sort mode to ascending by count"
);
assert_eq!(
node_by_index(&app, app.state.entries[0].index),
node_by_name(&app, fixture_str(long_root)),
"it recomputes the cached entries"
);
- // when hitting the S key again
+ // when hitting the S key
app.process_events(&mut terminal, into_keys(b"s".iter()))?;
assert_eq!(
app.state.sorting,
@@ -97,6 +104,22 @@ fn simple_user_journey_read_only() -> Result<()> {
"it sets the sort mode to descending by size"
);
assert_eq!(
+ node_by_index(&app, app.state.entries[1].index),
+ node_by_name(&app, fixture_str(long_root)),
+ "it recomputes the cached entries"
+ );
+ // when hitting the S key again
+ app.process_events(&mut terminal, into_keys(b"s".iter()))?;
+ assert_eq!(
+ app.state.sorting,
+ SortMode::SizeAscending,
+ "it sets the sort mode to ascending by size"
+ );
+ // hit the S key again to get Descending - the rest depends on it
+ app.process_events(&mut terminal, into_keys(b"s".iter()))?;
+ assert_eq!(app.state.sorting, SortMode::SizeDescending,);
+
+ assert_eq!(
node_by_index(&app, app.state.entries[0].index),
node_by_name(&app, fixture_str(short_root)),
"it recomputes the cached entries"