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

frontend: set timezone for tests #3837

Merged
merged 2 commits into from
Oct 1, 2023
Merged

Conversation

BacLuc
Copy link
Contributor

@BacLuc BacLuc commented Sep 23, 2023

Else frontend/src/helpers/tests/vCalendarDragAndDrop.spec.js toTime test fails if the timezone is not set to UTC.
Taken from vitest-dev/vitest#1575 (comment)

@usu
Copy link
Member

usu commented Sep 24, 2023

Maybe I'm missing the point. But shouldn't the tests run successfully, not matter with timezone is configured?

When/how did the tests fail for you?

@BacLuc
Copy link
Contributor Author

BacLuc commented Sep 24, 2023

If you create a new Date(2023,1,1,0,0).getTime(), the result is different if you are in UTC or in CEST.
This is no problem for our Calendar, because it also shifts the 08:00 line accordingly.

But if you have a test like frontend/src/helpers/tests/vCalendarDragAndDrop.spec.js toTime which compares the unix time result,
recorded in UTC, then it will only match if the test is run in UTC.
If you run the test in CEST, the unix timestamp will be off by 2 hours.

Run the test locally with npm (not in the container) and you will see.

@usu
Copy link
Member

usu commented Sep 28, 2023

Ah I understand. In that case, I'd actually propose to deliberately choose a different timezone than UTC (ideally one that is far away from UTC (e.g. Hawaii?) so not only the time is impacted, but in many cases also the date.

Otherwise it's too easy to write code that accidentally works with UTC but not for other timezones 😃

@BacLuc
Copy link
Contributor Author

BacLuc commented Sep 30, 2023

Done with 4e92511

Else frontend/src/helpers/__tests__/vCalendarDragAndDrop.spec.js toTime test fails
if the timezone is not set to UTC.
Taken from vitest-dev/vitest#1575 (comment)
That the test don't accidentally only work for UTC.
@BacLuc BacLuc force-pushed the frontend-tests-set-timezone branch from 4e92511 to 4da3103 Compare October 1, 2023 13:43
@usu usu enabled auto-merge October 1, 2023 13:57
@usu usu added this pull request to the merge queue Oct 1, 2023
Merged via the queue into ecamp:devel with commit 96d574c Oct 1, 2023
28 checks passed
@BacLuc BacLuc deleted the frontend-tests-set-timezone branch October 1, 2023 17:16
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.

None yet

3 participants