2021-01-17 12:54:49 -08:00
|
|
|
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
|
|
// allows you to do things like:
|
|
|
|
// expect(element).toHaveTextContent(/react/i)
|
|
|
|
// learn more: https://github.com/testing-library/jest-dom
|
2024-01-03 17:16:16 -05:00
|
|
|
import '@testing-library/jest-dom/vitest';
|
2021-01-17 12:54:49 -08:00
|
|
|
|
|
|
|
// Mock window.matchMedia interface.
|
|
|
|
// See https://jestjs.io/docs/en/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
|
|
|
// and https://github.com/ant-design/ant-design/issues/21096.
|
|
|
|
global.matchMedia =
|
|
|
|
global.matchMedia ||
|
|
|
|
(() => {
|
|
|
|
return {
|
|
|
|
matches: false,
|
2024-01-03 17:16:16 -05:00
|
|
|
addListener: vi.fn(),
|
|
|
|
removeListener: vi.fn(),
|
2021-01-17 12:54:49 -08:00
|
|
|
};
|
|
|
|
});
|
2021-05-28 02:23:09 +08:00
|
|
|
|
2024-01-03 17:16:16 -05:00
|
|
|
window.location = { ...window.location, replace: () => {} };
|
|
|
|
|
2024-03-26 17:18:54 -07:00
|
|
|
// Suppress `Error: Not implemented: window.computedStyle(elt, pseudoElt)`.
|
|
|
|
// From https://github.com/vitest-dev/vitest/issues/2061
|
|
|
|
// and https://github.com/NickColley/jest-axe/issues/147#issuecomment-758804533
|
|
|
|
const { getComputedStyle } = window;
|
|
|
|
window.getComputedStyle = (elt) => getComputedStyle(elt);
|
|
|
|
|
2024-01-03 17:16:16 -05:00
|
|
|
vi.mock('js-cookie', () => ({
|
|
|
|
default: {
|
|
|
|
get: () => 'urn:li:corpuser:2',
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
vi.mock('./app/entity/shared/tabs/Documentation/components/editor/Editor');
|