You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
652 B
21 lines
652 B
/** |
|
* globally import this, avoids needing to import it in each file |
|
* https://stackoverflow.com/a/65871118 |
|
*/ |
|
import '@testing-library/jest-dom'; |
|
|
|
// https://stackoverflow.com/a/66055672 |
|
// 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, |
|
addListener: jest.fn(), // Deprecated |
|
removeListener: jest.fn(), // Deprecated |
|
addEventListener: jest.fn(), |
|
removeEventListener: jest.fn(), |
|
dispatchEvent: jest.fn(), |
|
})), |
|
});
|
|
|