Skip to content

WS-NA: Temporal Migration (PR 1: Adds test coverage)#14099

Open
Isabella-Mitchell wants to merge 17 commits into
latestfrom
WS-NA-temporal-migrate-prep-tests
Open

WS-NA: Temporal Migration (PR 1: Adds test coverage)#14099
Isabella-Mitchell wants to merge 17 commits into
latestfrom
WS-NA-temporal-migrate-prep-tests

Conversation

@Isabella-Mitchell

@Isabella-Mitchell Isabella-Mitchell commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Resolves JIRA: WS-NA - 10% time. See plan

Summary

Increases test coverage for edge cases and timezones in preparation for migrating the psammead-timestamp-container from moment to temporal.

Code changes

src/app/legacy/containers/ArticleTimestamp

  • Adds formatTimestamp helper function used by new edge case tests
  • Adds edge case tests (for example - Daylight Saving Time)
  • Adds Chromatic story for some edge cases, and general timezone and locales (disabled on storybook)

src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js

  • Added cleanup so moment.now is reset after tests.
  • Adds more timezone and locale coverage to formatUnixTimestamp tests

src/app/lib/config/services/azeri.ts

  • fixes typo (was accepted by Moment but won't be by Temporal)

Testing

  1. Unit tests pass

Useful Links

@Isabella-Mitchell Isabella-Mitchell changed the title WS-NA: Temporal Migration (PR 1: Freeze current behavior with characterization tests) WS-NA: Temporal Migration (PR 1: Adds test coverage) Jul 3, 2026
timestamp: beforeDSTStart,
format: 'D MMMM YYYY, HH:mm z',
timezone,
locale,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, uses default locale since other tests in this file use this

expect(
formatTimestamp({
datetimeLocale: services.news.default.datetimeLocale,
timezone: services.news.default.timezone,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, gets datetimeLocale and timezone from the service config (similar to the other tests above)

@Isabella-Mitchell
Isabella-Mitchell marked this pull request as ready for review July 3, 2026 15:33
@Isabella-Mitchell
Isabella-Mitchell requested a review from Copilot July 3, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional timestamp edge-case coverage (DST boundaries, offset timezones, and non‑Latin locales) to de-risk the upcoming migration from Moment.js to Temporal, plus a small service timezone fix.

Changes:

  • Expanded formatUnixTimestamp unit tests to cover DST transitions, unusual offsets, and non‑Latin locale formatting.
  • Added ArticleTimestamp edge-case tests and a Chromatic-only story to visually validate timezone/locale output across services.
  • Corrected Azeri timezone identifier casing (Asia/Baku) to align with stricter IANA validation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/app/lib/config/services/azeri.ts Fixes timezone identifier casing for Azeri service config.
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js Adds broader timezone/locale test coverage and attempts to improve cleanup of mocked time sources.
src/app/legacy/containers/ArticleTimestamp/timeFormatTests/timeFormat.test.js Adds deterministic edge-case timestamp formatting assertions (DST/offsets).
src/app/legacy/containers/ArticleTimestamp/timeFormatTests/testUtils.js Introduces a helper to format arbitrary timestamps for edge-case tests without fixtures.
src/app/legacy/containers/ArticleTimestamp/timeFormatTests/README.md Clarifies DST wording in documentation.
src/app/legacy/containers/ArticleTimestamp/index.stories.jsx Adds a Chromatic-only multi-service timezone/locale comparison story.

Comment thread src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js Outdated
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.

5 participants