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

Correctly mock date.constructor #28

Merged
merged 3 commits into from Mar 27, 2024

Conversation

robaw
Copy link
Contributor

@robaw robaw commented Mar 25, 2024

What problem is this PR solving?

Currently, if you call .constructor() on an instance of a mocked date, you do not call the mock constructor. This change updates the constructor function on the mocked date to point to the mock date constructor.

Why is this necessary?

date-fns v3 calls the constructor in this way, meaning that in order to be compatible with date-fns v3, this fix will need to be in place.

@robaw
Copy link
Contributor Author

robaw commented Mar 25, 2024

Hi @hustcc, here is a bug fix to have this library continue to work with date-fns. We use this library and hope that we can release this fix for it soon.

@hustcc
Copy link
Owner

hustcc commented Mar 26, 2024

Can help to change travis to github action, like: https://github.com/hustcc/jest-random-mock/blob/main/.github/workflows/build.yml

  • remove travis config
  • update badge in readme.md
  • add github action workflows

@robaw
Copy link
Contributor Author

robaw commented Mar 26, 2024

Can help to change travis to github action, like: https://github.com/hustcc/jest-random-mock/blob/main/.github/workflows/build.yml

* [ ]  remove travis config

* [ ]  update badge in readme.md

* [ ]  add github action workflows

That sounds like outside of the scope of this bugfix contribution. Maybe raise it as issues in the repo if it's work that requires contributors.

@robaw
Copy link
Contributor Author

robaw commented Mar 27, 2024

@hustcc is this good to merge/release?

@hustcc
Copy link
Owner

hustcc commented Mar 27, 2024

@hustcc is this good to merge/release?

let me run the case locally first.

@hustcc hustcc mentioned this pull request Mar 27, 2024
3 tasks
@hustcc
Copy link
Owner

hustcc commented Mar 27, 2024

@robaw add github action in #29 , you can rebase master, then ci will run in this pr.

@robaw
Copy link
Contributor Author

robaw commented Mar 27, 2024

@robaw add github action in #29 , you can rebase master, then ci will run in this pr.

Rebased and pushed 👍

@hustcc hustcc merged commit 83c8617 into hustcc:master Mar 27, 2024
2 checks passed
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8451584168

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 46: 0.0%
Covered Lines: 19
Relevant Lines: 19

💛 - Coveralls

@hustcc
Copy link
Owner

hustcc commented Mar 27, 2024

jest-date-mock@1.0.9 released.

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

4 participants