From 71147c5083c15573a395960ca41725d300222504 Mon Sep 17 00:00:00 2001 From: le king fu Date: Tue, 6 Oct 2026 20:54:38 -0400 Subject: [PATCH] test(profiles): cover a v0.15-v0.17 secondary profile without history (#390) The released-states loop stops at v0.10-v0.14 (state E). State F, the consolidated schema of v0.15.0 to v0.17.0 without a history, only had its floor checked; this test runs the whole preparation on it: history recorded up to v17, nothing applied, no copy, flag repaired. Co-Authored-By: Claude Opus 5.5 --- src-tauri/src/database/profile_db.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src-tauri/src/database/profile_db.rs b/src-tauri/src/database/profile_db.rs index 9614d39..199eb83 100644 --- a/src-tauri/src/database/profile_db.rs +++ b/src-tauri/src/database/profile_db.rs @@ -851,6 +851,30 @@ mod tests { } } + #[test] + fn a_profile_from_v0_15_to_v0_17_gets_its_history_and_nothing_else() { + // State F: created with the current consolidated schema, before #390 + // wrote a history. Nothing to apply, so no copy either; the flag is + // still repaired. + let dir = unique_dir("state-f"); + let path = create_db(&dir, SECONDARY, &[crate::database::CONSOLIDATED_SCHEMA]); + let category = seed_user_rows(&open(&path)); + + let report = prepare_at(&path, SECONDARY, &migrations()).unwrap(); + + assert_eq!(report.catch_up_error, None); + let done = report.catch_up.unwrap(); + assert_eq!(done.floor, Some(17)); + assert_eq!(done.recorded, versions(1, max_version())); + assert!(done.applied.is_empty()); + assert_eq!(done.backup_file, None); + assert_eq!(report.repaired_flags, 1); + let conn = open(&path); + assert_history_complete(&conn, "state F"); + assert_eq!(count(&conn, "SELECT category_id FROM transactions"), category); + assert!(!dir.join(MIGRATION_BACKUP_DIR).exists()); + } + #[test] fn the_bilan_data_of_a_v0_9_profile_is_converted() { for state in released_states().into_iter().filter(|s| s.floor == 10) {