Skip to content

test(broadcasts): make calendar tests timezone-independent - #1176

Merged
realcodesiman merged 1 commit into
ChatbotXIO:mainfrom
rawdaymx:fix/calendar-tests-timezone
Sep 14, 2026
Merged

realcodesiman merged 1 commit into
ChatbotXIO:mainfrom
rawdaymx:fix/calendar-tests-timezone

Conversation

@rawdaymx

Copy link
Copy Markdown
Contributor

Fixes #1153.

broadcasts-calendar.test.tsx pins UTC instants in its schedulesAt fixtures while the component groups rows by local day, so 3 of 27 tests fail outside a narrow timezone band.

Converting the 11 fixtures alone is not enough, and this is the part worth flagging: the useFormatter mock at the top of the file renders through toISOString(), which is UTC. While the fixtures were also UTC instants the two cancelled out; once a fixture is a local 09:15, the mock prints its UTC projection (07:15 at +02:00). Fixtures-only takes the file from 3 failures west / 2 at +12 down to 1 failure in every zone except UTC — better, but now also broken in Europe/Madrid and Asia/Tokyo, which passed before.

So the mock moves to local as well, using the format from date-fns the file already imports.

Verification

Run on this branch, one zone per run:

TZ Offset Result
America/Hermosillo −07:00 27 passed
America/New_York −04:00 27 passed
America/Sao_Paulo −03:00 27 passed
UTC 00:00 27 passed
Europe/Madrid +02:00 27 passed
Asia/Tokyo +09:00 27 passed
Pacific/Auckland +12:00 27 passed

ultracite check is clean. Test-only change — no production code touched.

The suite pinned UTC instants in `schedulesAt` fixtures while the component
groups rows by local day, so 3 of 27 tests failed outside a narrow timezone
band.

Converting the 11 fixtures alone is not enough: the `useFormatter` mock at the
top of the file renders through `toISOString()`, which is UTC. While the
fixtures were also UTC instants the two cancelled out; once a fixture is a
local `09:15`, the mock prints its UTC projection (`07:15` at +02:00). The mock
has to move to local as well, via the `format` from `date-fns` the file already
imports.

Verified 27/27 in seven zones: America/Hermosillo (-07), America/New_York
(-04), America/Sao_Paulo (-03), UTC, Europe/Madrid (+02), Asia/Tokyo (+09),
Pacific/Auckland (+12).

Fixes ChatbotXIO#1153
@realcodesiman
realcodesiman merged commit 8db86f0 into ChatbotXIO:main Sep 14, 2026
4 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
The suite pinned UTC instants in `schedulesAt` fixtures while the component
groups rows by local day, so 3 of 27 tests failed outside a narrow timezone
band.

Converting the 11 fixtures alone is not enough: the `useFormatter` mock at the
top of the file renders through `toISOString()`, which is UTC. While the
fixtures were also UTC instants the two cancelled out; once a fixture is a
local `09:15`, the mock prints its UTC projection (`07:15` at +02:00). The mock
has to move to local as well, via the `format` from `date-fns` the file already
imports.

Verified 27/27 in seven zones: America/Hermosillo (-07), America/New_York
(-04), America/Sao_Paulo (-03), UTC, Europe/Madrid (+02), Asia/Tokyo (+09),
Pacific/Auckland (+12).

Fixes #1153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calendar tests fail outside a narrow timezone band: broadcasts-calendar.test.tsx pins UTC instants while the component groups by local day

2 participants