iamkun / iamkun/dayjs

Extend property based tests to check if dayjs behaves similar to moment.

Open
#271 2 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.