26 lines
936 B
TypeScript
26 lines
936 B
TypeScript
// Optional: configure or set up a testing framework before each test.
|
|
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.*`
|
|
|
|
// Used for __tests__/testing-library.js
|
|
// Learn more: https://github.com/testing-library/jest-dom
|
|
import '@testing-library/jest-dom';
|
|
|
|
// To get 'next/router' working with tests
|
|
jest.mock('next/router', () => require('next-router-mock'));
|
|
|
|
// jsdom does not implement window.matchMedia, which MUI's CSS-variable theme
|
|
// (CssVarsProvider) relies on to track the system color-scheme preference.
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: (query: string) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // Deprecated, but still called by MUI for old browsers
|
|
removeListener: jest.fn(), // Deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn(),
|
|
}),
|
|
});
|