datahub/datahub-web-react/src/setupTests.ts

28 lines
874 B
TypeScript
Raw Normal View History

// 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
import '@testing-library/jest-dom/vitest';
// 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,
addListener: vi.fn(),
removeListener: vi.fn(),
};
});
window.location = { ...window.location, replace: () => {} };
vi.mock('js-cookie', () => ({
default: {
get: () => 'urn:li:corpuser:2',
},
}));
vi.mock('./app/entity/shared/tabs/Documentation/components/editor/Editor');