test(profiles): cover a v0.15-v0.17 secondary profile without history (#390)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 1m54s
PR Check — Rust / rust (pull_request) Successful in 5m9s

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 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-10-06 20:54:38 -04:00
parent 02fca2ad3c
commit 71147c5083

View file

@ -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] #[test]
fn the_bilan_data_of_a_v0_9_profile_is_converted() { fn the_bilan_data_of_a_v0_9_profile_is_converted() {
for state in released_states().into_iter().filter(|s| s.floor == 10) { for state in released_states().into_iter().filter(|s| s.floor == 10) {