From 29d0f22c9ce81a88beb80bbd7f71f9f3ee09562b Mon Sep 17 00:00:00 2001 From: le king fu Date: Sun, 15 Nov 2026 01:10:36 -0500 Subject: [PATCH] test(web): the Quebec cases of the parity test restore the zone they found (#201) Their afterEach wrote `UTC` back, so they could stand in for the first statement of the file: with that statement removed, the parity cases that ran after them still passed (found by mutation, one red test instead of five). The hook now restores the zone read when the file is collected. Co-Authored-By: Claude Fable 5.2 --- web/src/test/sync/recurrence.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/test/sync/recurrence.test.ts b/web/src/test/sync/recurrence.test.ts index 38a8aa6..c049c5c 100644 --- a/web/src/test/sync/recurrence.test.ts +++ b/web/src/test/sync/recurrence.test.ts @@ -83,8 +83,14 @@ describe('nextOccurrence of the companion against getNextOccurrence of the app, // app keeps the local time and the day of the local month, the companion the // UTC time and the day of the UTC month. describe('in Quebec (America/Toronto), the companion and the app differ', () => { + // Each test sets the zone of Quebec, then the zone of the file comes back: + // the one its first statement set, read here and not written again, so that + // these tests cannot stand in for that statement. + const zone = process.env.TZ; + afterEach(() => { - process.env.TZ = 'UTC'; + if (zone === undefined) delete process.env.TZ; + else process.env.TZ = zone; }); // [due date, recurrence, next occurrence of the companion, of the app]