test: pin the amount condition of isOffsetChild under a parent of zero (#454)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m30s

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 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-10-27 22:14:49 -04:00
commit e130c346c5

View file

@ -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", () => {