Skip to content

Conversation

cquirosj
Copy link
Contributor

@cquirosj cquirosj commented Jun 20, 2025

Make the saga diagram use toLocaleString as the rest of the diagrams do.

What is included in this PR?

  • Make the SagaDiagram render date and time consistently with the way the other diagrams render date and time by also using toLocaleString
  • Make two test scenarios use the same test code by passing scenario specifics through test.each, as they were almost identical.
  • Improve test reliability by using toLocaleString() for date assertions, ensuring tests remain stable across different developer environments and OS localization settings (e.g., en-US vs en-AU). This approach balances the gold standard of hardcoded assertions that don't require computation or duplicate the system under test (SUT) code, against the practical need for environment-independent tests. While this duplicates formatting logic from the implementation, it preserves the test's core intent, verifying date ordering and timezone localization, without importing anything from the internals of the component under test.

Make the saga diagram use toLocaleString as the rest of the diagrams do
@cquirosj cquirosj requested a review from soujay June 20, 2025 17:42
@cquirosj cquirosj mentioned this pull request Jun 20, 2025
@cquirosj cquirosj merged commit b7d1cef into master Jun 20, 2025
5 checks passed
@cquirosj cquirosj deleted the component-test-fix branch June 20, 2025 20:32
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.

Locale-sensitive datetime formatting causes test failures on non-US locales
2 participants