From eff9b13c66e6ad3c66345672cf64c5e231c98d39 Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Sun, 14 Jun 2026 11:22:04 -0400 Subject: [PATCH] =?UTF-8?q?fix(11):=20make=20CI=20green=20=E2=80=94=20pin?= =?UTF-8?q?=20TZ=20in=20all-day=20scheduler=20tests,=20drop=20redundant=20?= =?UTF-8?q?casts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fast-checks failed on 3 no-unnecessary-type-assertion ESLint errors (reminderIsCustom is now a real CalendarOccurrence field). api failed on 4 all-day 9 AM-local tests that assumed a UTC-4 host; CI runs UTC. Pin process.env.TZ=America/New_York in the all-day describe (production code reads TZ at call time, D-04). Co-Authored-By: Claude Opus 4.8 --- apps/api/tests/broker/reminderScheduler.test.ts | 7 +++++++ apps/pwa/src/components/EventForm.test.tsx | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/api/tests/broker/reminderScheduler.test.ts b/apps/api/tests/broker/reminderScheduler.test.ts index 293f6ec..b86946d 100644 --- a/apps/api/tests/broker/reminderScheduler.test.ts +++ b/apps/api/tests/broker/reminderScheduler.test.ts @@ -659,8 +659,13 @@ describe('reminderScheduler — NOTIF-06: all-day 9 AM-local fire branch', () => // All-day tests use the server timezone (America/New_York = UTC-4 in summer). // computeAlertInstantUtc('2026-06-15', 0, 'America/New_York') = 2026-06-15T13:00:00Z. // Tests set `now` to the expected alert UTC to trigger the fire window. + // Pin TZ explicitly so these assertions are deterministic regardless of the host/CI + // timezone (CI runs UTC; the scheduler reads process.env.TZ at call time, D-04). + let prevTz: string | undefined; beforeEach(() => { + prevTz = process.env.TZ; + process.env.TZ = 'America/New_York'; vi.useFakeTimers(); vi.resetModules(); }); @@ -668,6 +673,8 @@ describe('reminderScheduler — NOTIF-06: all-day 9 AM-local fire branch', () => afterEach(() => { vi.useRealTimers(); vi.clearAllMocks(); + if (prevTz === undefined) delete process.env.TZ; + else process.env.TZ = prevTz; }); it('all-day 0-lead fires at 9 AM local (not midnight) on event date', async () => { diff --git a/apps/pwa/src/components/EventForm.test.tsx b/apps/pwa/src/components/EventForm.test.tsx index 87e4290..b7ee23f 100644 --- a/apps/pwa/src/components/EventForm.test.tsx +++ b/apps/pwa/src/components/EventForm.test.tsx @@ -1246,7 +1246,7 @@ describe('EventForm — Phase 11 reminder picker (Plan 04)', () => { * This field is added by Plan 05 — before the fix, CalendarOccurrence does not carry it, * so the form cannot distinguish custom from no-reminder. */ -const CUSTOM_ALARM_OCCURRENCE: CalendarOccurrence & { reminderIsCustom?: boolean } = { +const CUSTOM_ALARM_OCCURRENCE: CalendarOccurrence = { id: 'custom-alarm-uid::2026-12-15', uid: 'custom-alarm-uid', calendarId: 1, @@ -1280,7 +1280,7 @@ describe('EventForm — Phase 11 Plan 05 CR-01: custom alarm round-trip', () => renderForm({ mode: 'edit', uid: 'custom-alarm-uid', - eventOccurrence: CUSTOM_ALARM_OCCURRENCE as CalendarOccurrence, + eventOccurrence: CUSTOM_ALARM_OCCURRENCE, }); const reminderSelect = document.querySelector('#event-reminder') as HTMLSelectElement; @@ -1293,7 +1293,7 @@ describe('EventForm — Phase 11 Plan 05 CR-01: custom alarm round-trip', () => renderForm({ mode: 'edit', uid: 'custom-alarm-uid', - eventOccurrence: CUSTOM_ALARM_OCCURRENCE as CalendarOccurrence, + eventOccurrence: CUSTOM_ALARM_OCCURRENCE, }); // The read-only "Custom (kept)" option must be visible @@ -1307,7 +1307,7 @@ describe('EventForm — Phase 11 Plan 05 CR-01: custom alarm round-trip', () => renderForm({ mode: 'edit', uid: 'custom-alarm-uid', - eventOccurrence: CUSTOM_ALARM_OCCURRENCE as CalendarOccurrence, + eventOccurrence: CUSTOM_ALARM_OCCURRENCE, }); // Change the title to simulate a real edit