mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
19 lines
546 B
TypeScript
19 lines
546 B
TypeScript
|
// 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,
|
||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||
|
media: query,
|
||
|
onchange: null,
|
||
|
addListener: jest.fn(), // Deprecated
|
||
|
removeListener: jest.fn(), // Deprecated
|
||
|
addEventListener: jest.fn(),
|
||
|
removeEventListener: jest.fn(),
|
||
|
dispatchEvent: jest.fn(),
|
||
|
})),
|
||
|
});
|
||
|
|
||
|
export {};
|