Repository navigation
[No QA] Make subscription and search date tests timezone-independent - #105886
Closed
shubham1206agra wants to merge 1 commit into
Closed
shubham1206agra wants to merge 1 commit into
shubham1206agra wants to merge 1 commit into
Conversation
Build the subscription fixtures in UTC, since the helpers read the NVPs back as UTC, and pin the search preset clock to local noon so it stays on the same day in timezones ahead of UTC+12. Both suites now pass outside UTC.
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.
Explanation of Change
Two test suites only passed when Jest ran in UTC:
SubscriptionUtilsTestbuilt its subscription NVP fixtures with date-fnsformat, which uses the device's timezone. The helpers under test read those values back as UTC (by appendingZ), so on a machine outside UTC the fixtures were off by the offset, and the assertions that compare within a day failed. The fixtures are now formatted in UTC.SearchQueryUtilsTestpinned "now" to12:00Z. Presets such as year-to-date resolve "today" in the user's own zone, so past UTC+12 the clock lands on the next local day and the expected range shifts. It is now pinned to local noon.npm testsetsTZ=utc, so CI was not affected, but running a single test file withnpx jeston a machine outside UTC failed. Both suites now pass in UTC, Asia/Calcutta, America/Los_Angeles and Pacific/Kiritimati.This is test-only and was split out of the date-localization work in #105846.
Fixed Issues
$ #98088
PROPOSAL:
Tests
TZ=Asia/Calcutta npx jest tests/unit/SubscriptionUtilsTest.ts tests/unit/Search/SearchQueryUtilsTest.tsand verify both pass.TZ=Pacific/KiritimatiandTZ=America/Los_Angelesand verify both pass.Offline tests
N/A, test-only change.
QA Steps
[No QA] Test-only change.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari