test(core:ui): add unit tests for SystemDateTimeFormatter (POS-58)#643
Draft
mtrewartha wants to merge 2 commits into
Draft
test(core:ui): add unit tests for SystemDateTimeFormatter (POS-58)#643mtrewartha wants to merge 2 commits into
mtrewartha wants to merge 2 commits into
Conversation
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
Cover all seven days in a single it block rather than three separate context/it pairs. https://claude.ai/code/session_016Eu54qaDDroj3tKDZtsvhA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClockandTimeZoneintoSystemDateTimeFormatterso the class is fully testable without relying on global JVM state (Clock.SystemandTimeZone.currentSystemDefault())localethrough to allSimpleDateFormatinstances — previously onlyfullDayOfWeekFormatreceived it, leaving the others at the JVM defaulttimeZone(): TimeZoneprovider toAppProvidersSystemDateTimeFormatterTestwith DescribeSpec-style coverage for all four formatter methodsTest plan
formatting a date— verifies medium-format date output (Jan 15, 2024)formatting a date and time— verifies medium-date + short-time outputformatting the full day of the week— verifies English day names for Monday, Wednesday, and Sundayformatting a time / when seconds are not requested— verifies seconds are omitted from SHORT formatformatting a time / when seconds are requested— verifies seconds are present in MEDIUM format:core:ui:testGmsDebugUnitTestto confirm all tests passhttps://claude.ai/code/session_016Eu54qaDDroj3tKDZtsvhA
Generated by Claude Code