You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
926 B
TypeScript
30 lines
926 B
TypeScript
// frontend/tests/setup.ts — vitest 전역 setup
|
|
import "@testing-library/jest-dom/vitest";
|
|
import { expect, vi } from "vitest";
|
|
import { toHaveNoViolations } from "vitest-axe/dist/matchers";
|
|
|
|
expect.extend({ toHaveNoViolations });
|
|
|
|
// jsdom 미구현 API 폴리필 (ResizeObserver — 여정 베지어 보드가 사용)
|
|
if (!("ResizeObserver" in globalThis)) {
|
|
(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver = class {
|
|
observe() {}
|
|
unobserve() {}
|
|
disconnect() {}
|
|
};
|
|
}
|
|
|
|
// jsdom 미구현 API 폴리필 (next-themes 가 window.matchMedia 사용)
|
|
if (!window.matchMedia) {
|
|
window.matchMedia = vi.fn().mockImplementation((query: string) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(), // deprecated
|
|
removeListener: vi.fn(), // deprecated
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
}));
|
|
}
|