Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update jest mock [DHIS2-15415] #314

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Conversation

tomzemp
Copy link
Member

@tomzemp tomzemp commented Aug 8, 2023

I thought (πŸ€¦β€β™‚οΈ) I had fixed this issue with #276...

but unfortunately, I guessed incorrectly about how moment.fromNow() works.

I thought that if today were 8 August 2023 and the comparison date was 1 January 2021, that the relative date would be "two years ago", but it turns out moment.fromNow()` rounds up and returns "three years ago" in this case.

Which causes these tests to fail again, so, in order to work with what our test expects ("two years ago"), I've updated the moment mocking to return a date exactly two years previous to the current date, so that moment(someDate).fromNow() should now return "two years ago".

(sorry πŸ˜”)

@tomzemp tomzemp requested review from a team as code owners August 8, 2023 11:50
@dhis2-bot
Copy link
Contributor

πŸš€ Deployed on https://pr-314--dhis2-data-approval.netlify.app

@kabaros kabaros merged commit 3b2ca75 into master Sep 13, 2023
11 checks passed
@kabaros kabaros deleted the DHIS2-15554/fix-jest-test branch September 13, 2023 15:27
@dhis2-bot
Copy link
Contributor

πŸŽ‰ This PR is included in version 100.0.8 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants