Skip to content

test(core:ui): add unit tests for SystemDateTimeFormatter (POS-58)#643

Draft
mtrewartha wants to merge 2 commits into
mainfrom
claude/testing-styles-rules-km3Vj
Draft

test(core:ui): add unit tests for SystemDateTimeFormatter (POS-58)#643
mtrewartha wants to merge 2 commits into
mainfrom
claude/testing-styles-rules-km3Vj

Conversation

@mtrewartha

Copy link
Copy Markdown
Owner

Summary

  • Inject Clock and TimeZone into SystemDateTimeFormatter so the class is fully testable without relying on global JVM state (Clock.System and TimeZone.currentSystemDefault())
  • Thread the injected locale through to all SimpleDateFormat instances — previously only fullDayOfWeekFormat received it, leaving the others at the JVM default
  • Add a timeZone(): TimeZone provider to AppProviders
  • Add SystemDateTimeFormatterTest with DescribeSpec-style coverage for all four formatter methods

Test plan

  • formatting a date — verifies medium-format date output (Jan 15, 2024)
  • formatting a date and time — verifies medium-date + short-time output
  • formatting the full day of the week — verifies English day names for Monday, Wednesday, and Sunday
  • formatting a time / when seconds are not requested — verifies seconds are omitted from SHORT format
  • formatting a time / when seconds are requested — verifies seconds are present in MEDIUM format
  • Run :core:ui:testGmsDebugUnitTest to confirm all tests pass

https://claude.ai/code/session_016Eu54qaDDroj3tKDZtsvhA


Generated by Claude Code

Inject Clock and TimeZone into SystemDateTimeFormatter so the formatter
can be fully tested without relying on global JVM state. Also thread the
locale through to all SimpleDateFormat instances (previously only
fullDayOfWeekFormat received it) so locale and timezone are applied
consistently. Add AppProviders entry for TimeZone.

https://claude.ai/code/session_016Eu54qaDDroj3tKDZtsvhA
@mtrewartha mtrewartha changed the title test(core:ui): add unit tests for SystemDateTimeFormatter test(core:ui): add unit tests for SystemDateTimeFormatter (POS-58) May 30, 2026
Cover all seven days in a single it block rather than three separate
context/it pairs.

https://claude.ai/code/session_016Eu54qaDDroj3tKDZtsvhA
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.

2 participants