shlink-web-client/config/test/setupTests.ts

25 lines
593 B
TypeScript
Raw Normal View History

import '@testing-library/jest-dom/vitest';
2023-05-27 12:36:18 +03:00
import { cleanup } from '@testing-library/react';
2023-09-30 11:20:28 +03:00
import axe from 'axe-core';
import { afterEach } from 'vitest';
2023-05-27 12:36:18 +03:00
2023-09-30 11:20:28 +03:00
axe.configure({
checks: [
{
// Disable color contrast checking, as it doesn't work in jsdom
id: 'color-contrast',
enabled: false,
},
],
});
// Clear all mocks and cleanup DOM after every test
2023-05-27 12:36:18 +03:00
afterEach(() => {
vi.clearAllMocks();
2023-05-27 12:36:18 +03:00
cleanup();
});
2023-12-09 13:23:22 +03:00
HTMLCanvasElement.prototype.getContext = (() => {}) as any;
2023-05-27 12:36:18 +03:00
(global as any).scrollTo = () => {};
(global as any).matchMedia = () => ({ matches: false });