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

Implement a good way to mock tests with timezone and DST dependencies #589

Open
kenpugsley opened this issue Apr 20, 2020 · 4 comments
Open
Assignees
Labels
help wanted Extra attention is needed High Priority High importance / High value tech debt Technical issues that we need to come back to

Comments

@kenpugsley
Copy link
Collaborator

Pure tech debt item. We have a few unit tests (notably LocationService.spec.js and ExposureHistory.spec.js) that must mock the current datetime, but are sensitive to the timezone and daylight savings time. We need to come up with a good solution for unit testing the edge cases around these tests, as well as ensuring that the tests don't have any lurking system time / timezone sensitivity.

@kenpugsley kenpugsley added High Priority High importance / High value tech debt Technical issues that we need to come back to help wanted Extra attention is needed labels Apr 20, 2020
@lewisPrescott707
Copy link
Contributor

I can have a look at this tomorrow

@Patrick-Erichsen
Copy link
Contributor

@lewisPrescott707 any progress here?

@lewisPrescott707
Copy link
Contributor

@lewisPrescott707 any progress here?

Not yet I'm afraid, as not had time.
Looks like timezone is not supported by dayjs which makes mocking tricky.
Will take another look at the weekend

@lewisPrescott707
Copy link
Contributor

@kenpugsley @Patrick-Erichsen sorry I don't really have the knowledge of the Intersect.js to be able to create the data for the tests. So I have created a PR to demonstrate how to mock the timezones with dayjs. PR-906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed High Priority High importance / High value tech debt Technical issues that we need to come back to
Projects
None yet
Development

No branches or pull requests

3 participants