2022-12-04 22:15:59 -05:00
|
|
|
if (typeof window === 'undefined') {
|
|
|
|
global.window = {
|
|
|
|
URL: {
|
|
|
|
createObjectURL: jest.fn(),
|
|
|
|
},
|
|
|
|
localStorage: {
|
|
|
|
removeItem: jest.fn(),
|
|
|
|
getItem: jest.fn(),
|
|
|
|
},
|
2022-12-11 09:03:53 -05:00
|
|
|
navigator: {
|
|
|
|
platform: 'Win',
|
|
|
|
},
|
2024-01-03 15:14:09 -05:00
|
|
|
matchMedia: () => ({
|
|
|
|
matches: false,
|
|
|
|
}),
|
2022-12-04 22:15:59 -05:00
|
|
|
};
|
|
|
|
}
|
2022-12-13 10:31:35 -05:00
|
|
|
|
|
|
|
global.URL.createObjectURL = jest.fn();
|
2024-01-03 15:14:09 -05:00
|
|
|
|
|
|
|
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(),
|
|
|
|
})),
|
|
|
|
});
|