Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

date: Add some basic tests, and fix a bug #73

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

AtkinsSJ
Copy link
Contributor

@AtkinsSJ AtkinsSJ commented Apr 1, 2024

This is using the mockdate package, so that we can force new Date() to return a specific value. Otherwise, it would be really unpleasant to try and make these reliable!

Now using chronokinesis. I'm not sure it's actually necessary, but I switched to it as part of trying to make the timezone names consistent, and it seems like it can't hurt. It also has a much cooler name. 😎

@AtkinsSJ
Copy link
Contributor Author

AtkinsSJ commented Apr 1, 2024

Dang it, I thought timezones might be an issue. More mocking is required...

@AtkinsSJ AtkinsSJ marked this pull request as draft April 1, 2024 14:53
AtkinsSJ added 3 commits April 1, 2024 17:33
This causes dates and times to be calculated in UTC instead of the local
timezone. Which will be helpful in making my tests actually work!
This was outputting the entire date with timezone, instead of just the
timezone.
Using the chronokinesis library for mocking the date and timezone. All
the tests use the `--utc` option so that the output doesn't vary
depending on the local system timezone.
@AtkinsSJ AtkinsSJ force-pushed the date-builtin-tests branch from ebbb2a4 to 194adfa Compare April 1, 2024 16:40
@AtkinsSJ AtkinsSJ marked this pull request as ready for review April 1, 2024 16:41
@AtkinsSJ
Copy link
Contributor Author

AtkinsSJ commented Apr 1, 2024

Fixed the timezone output issues. As a bonus, date now supports the --utc option!

@KernelDeimos KernelDeimos merged commit 5538e23 into HeyPuter:trunk Apr 10, 2024
3 checks passed
@AtkinsSJ AtkinsSJ deleted the date-builtin-tests branch April 10, 2024 14:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants