From e130c346c597f922ac83e959b1987cc9cdce284b Mon Sep 17 00:00:00 2001 From: le king fu Date: Tue, 27 Oct 2026 22:14:49 -0400 Subject: [PATCH] test: pin the amount condition of isOffsetChild under a parent of zero (#454) The mutation pass left one mutation green: without `child.amount !== 0`, every existing case still failed on the sign test. Only under a parent of zero does a child of zero pass it (Math.sign(0) === -Math.sign(0), since 0 === -0); the test now covers that case. Co-Authored-By: Claude Opus 5.5 --- src/utils/splitOffset.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/splitOffset.test.ts b/src/utils/splitOffset.test.ts index e4572e1..b062f38 100644 --- a/src/utils/splitOffset.test.ts +++ b/src/utils/splitOffset.test.ts @@ -45,6 +45,11 @@ describe("isOffsetChild (#454)", () => { it("refuses an amount of zero", () => { expect(isOffsetChild(PARENT, child(0, A))).toBe(false); expect(isOffsetChild(PARENT, child(-0, A))).toBe(false); + // Under a parent of zero, a child of zero passes the sign test + // (Math.sign(0) === -Math.sign(0), since 0 === -0): only the amount refuses it. + const zero = { description: PARENT.description, amount: 0 }; + expect(isOffsetChild(zero, child(0, A))).toBe(false); + expect(isOffsetChild(zero, child(-0, A))).toBe(false); }); it("recognizes the offset line of a split income: a positive parent, a negative offset", () => {