Created
July 12, 2022 07:32
-
-
Save AvocadoVenom/dc38bee871196f8196f2c1c3901e322a to your computer and use it in GitHub Desktop.
This file contains 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
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom | |
Object.defineProperty(window, 'matchMedia', { | |
writable: true, | |
value: jest.fn().mockImplementation(query => ({ | |
matches: false, | |
media: query, | |
onchange: null, | |
addEventListener: jest.fn(), | |
removeEventListener: jest.fn(), | |
dispatchEvent: jest.fn() | |
})) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment