From daeb1655ab9af97e3232392f7420032e072d6f89 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 6 May 2026 05:22:56 +0200 Subject: [PATCH] Test: Add unit test for processing hashes in newest-first order --- src-tauri/src/main.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index ffd19f9..528f44a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -3567,3 +3567,27 @@ fn main() { .run(tauri::generate_context!()) .expect("error while running tauri application"); } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn reword_hashes_are_processed_newest_first() { + let all_commits = vec![ + "ccccccc333333333333333333333333333333333".to_string(), + "bbbbbbb222222222222222222222222222222222".to_string(), + "aaaaaaa111111111111111111111111111111111".to_string(), + ]; + let hashes = vec![ + "aaaaaaa".to_string(), + "ccccccc".to_string(), + "bbbbbbb".to_string(), + ]; + + assert_eq!( + resolve_reword_hashes_newest_first(&all_commits, &hashes), + all_commits + ); + } +}