Extend property based tests to check if dayjs behaves similar to moment.
Open
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Currently the tests check a single value. Currently the tests look like this.
```js
it('Set Day', () => {
expect(dayjs().set('date', 30).valueOf()).toBe(moment().set('date', 30).valueOf())
})
```
We only know if this is working when setting the date to `30` and that it works for the "current time"(now).
We could extend this test by generating a random date and using all allowed and disallowed day values. The goal here is to catch edge cases.
I suggest using pseudorandom value functions and randomly generated seeds. That way every time someone runs the tests, they could potentially catch an edge-case. The seed allows one to reproduce the failing test.
Contributor guide
Assessment
This issue has not been assessed yet.