From 9a96a9fad5c9bdf609e44a91054c778702672b9e Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Sat, 28 Feb 2026 00:19:29 +0000 Subject: [PATCH] fix(test): handle 0/-0 in getComparator anti-symmetry property test Bun's expect().toBe() uses Object.is() which distinguishes +0 from -0. When two issues have identical sort fields, cmp(a,b) = 0 and cmp(b,a) = -0, so Math.sign(0) !== -Math.sign(-0) under Object.is(). Use ab + ba === 0 instead, which correctly treats 0 + -0 as 0. Same fix already applied to compareDates but missed for getComparator. --- test/commands/issue/list.property.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/commands/issue/list.property.test.ts b/test/commands/issue/list.property.test.ts index a24e78af..bdb9faee 100644 --- a/test/commands/issue/list.property.test.ts +++ b/test/commands/issue/list.property.test.ts @@ -305,7 +305,9 @@ describe("property: getComparator", () => { const cmp = getComparator(sort); const ab = cmp(a, b); const ba = cmp(b, a); - expect(Math.sign(ab)).toBe(-Math.sign(ba)); + // ab + ba === 0 is the anti-symmetry check that handles 0/-0 correctly + // (Object.is(0, -0) is false, but 0 + -0 === 0) + expect(ab + ba).toBe(0); }), { numRuns: DEFAULT_NUM_RUNS } );