From a2c4fd4685b473e97dd8a6ee6fcf894fb58db4b8 Mon Sep 17 00:00:00 2001 From: le king fu Date: Mon, 19 Oct 2026 21:10:03 -0400 Subject: [PATCH] test(budget): a collapsed sub-group last in its group keeps its subtotal (#446) Review 25487, point 2 (R13): [A, z, Vide] gives z, Vide, A; dropping the subtotal of an empty block at the final flush turned no test red. Co-Authored-By: Claude Opus 5.5 --- src/utils/reorderRows.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/reorderRows.test.ts b/src/utils/reorderRows.test.ts index 473e97d..528fdd5 100644 --- a/src/utils/reorderRows.test.ts +++ b/src/utils/reorderRows.test.ts @@ -86,6 +86,11 @@ describe("reorderRows — subtotals at the bottom (issue #424)", () => { expect(names(reorderRows(rows, false))).toEqual(["Vide", "z", "A"]); }); + it("a collapsed sub-group last in its group keeps its subtotal, before the group's own", () => { + const rows: Row[] = [sub("A", 0), leaf("z", 1), sub("Vide", 1)]; + expect(names(reorderRows(rows, false))).toEqual(["z", "Vide", "A"]); + }); + it("the same block, followed by a sibling root: the root closes after its own rows", () => { const block: Row[] = [sub("A", 0), sub("Vide", 1), leaf("z", 1)]; // A root group...