Last active
March 18, 2019 12:32
-
-
Save Saturate/89af00eea2c668f0eb6668811252c416 to your computer and use it in GitHub Desktop.
Mocking Date.prototype.toLocaleString with Jest, as it's not working in jsdom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.now = jest.fn(() => 1482363367071); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date = jest.fn(() => ({ | |
toLocaleString: jest.fn(() => '12.3.2019 13.47.47') | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment