test(rollups): compare migration 0372's untouched columns right after it ran

A later case in the file folds the rollups again, and a fold sums in the
order its plan reads, so the second fold's sums could differ from the
first's in the last bit; the comparison read the table after that fold.
This commit is contained in:
Marc-André Bombeck committed 2026-10-25 06:51:51 +01:00
1 parent f66e7e9a93
commit ca77d507f6
1 file changed
+10 -3
@@ -102,6 +102,13 @@ const readRows = () =>
`;
let before: Row[] = [];
/**
* The rows right after the migration. "Matches what the writer stores now"
* folds the rollups again, and a fold sums in whatever order the plan reads,
* so its sums can differ from the first fold's in the last bit; what the
* migration left is compared from here.
*/
let migrated: Row[] = [];
beforeAll(async () => {
await truncateAllTables(prisma);
@@ -121,6 +128,7 @@ beforeAll(async () => {
`;
before = await readRows();
await runMigration();
migrated = await readRows();
}, 120_000);
const meanOf = (all: Row[], type: string, granularity: string, at?: number) =>
@@ -187,10 +195,9 @@ describe("migration 0372", () => {
}
});
it("leaves every column but mean alone", async () => {
const after = await readRows();
it("leaves every column but mean alone", () => {
const strip = ({ mean: _mean, ...rest }: Row) => rest;
expect(after.map(strip)).toEqual(before.map(strip));
expect(migrated.map(strip)).toEqual(before.map(strip));
});
it("is idempotent", async () => {