From 32b7c2e5187cb226490b060dae8bf9069636df5a Mon Sep 17 00:00:00 2001 From: le king fu Date: Wed, 4 Nov 2026 22:34:12 -0500 Subject: [PATCH] test: pin the transfers' creation dates, renumber rows no transfer holds (#521) The creation date of a restored transfer is now compared against a value set apart from the clock, so a restore that wrote its own would show. The file whose rows do not keep their ids now gives a duplicate id to two rows no transfer holds: the linked rows come back unchanged in the file, and only the renumbering by SQLite unlinks them, which the preview must announce too. Co-Authored-By: Claude Opus 5.5 --- src/__integration__/restore.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/__integration__/restore.test.ts b/src/__integration__/restore.test.ts index 115ce4f..bbca03e 100644 --- a/src/__integration__/restore.test.ts +++ b/src/__integration__/restore.test.ts @@ -483,6 +483,9 @@ describe("restoring a profile that holds a Bilan transfer (#521)", () => { // As « Lier transferts » links them, by the real service. await linkTransfer(CELI, contribution, "in", "Cotisation d'octobre"); await linkTransfer(REER, withdrawal, "out"); + // Dates of creation set apart from the clock: a restore that wrote its own would show. + profile.prepare("UPDATE balance_account_transfers SET created_at = '2026-10-04 09:15:00' WHERE id = 1").run(); + profile.prepare("UPDATE balance_account_transfers SET created_at = '2026-10-06 18:30:00' WHERE id = 2").run(); transfersBefore = transfersOf(profile); expect(transfersBefore.map((t) => [t.id, t.account_id, t.transaction_id, t.direction])).toEqual([ [1, CELI, contribution, "in"], @@ -565,12 +568,13 @@ describe("restoring a profile that holds a Bilan transfer (#521)", () => { [], ], [ - "its rows do not keep their ids (two share one, no split line)", + // The two linked rows come back unchanged in the file, but SQLite renumbers every row. + "its rows do not keep their ids (« PAIE » bears the id of « LOYER », no split line)", (data) => ({ ...data, transactions: (data.transactions ?? []) .filter((tx) => tx.parent_transaction_id === null) - .map((tx) => (tx.id === 7 ? { ...tx, id: 6 } : { ...tx, is_split: 0 })), + .map((tx) => ({ ...tx, id: tx.id === 3 ? 2 : tx.id, is_split: 0 })), }), [], ],