mirror of
https://github.com/lordmathis/lemma.git
synced 2025-12-24 02:24:25 +00:00
Initial vitest setup
This commit is contained in:
30
app/src/test/setup.ts
Normal file
30
app/src/test/setup.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import '@testing-library/jest-dom';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
// Mock window.API_BASE_URL
|
||||
Object.defineProperty(window, 'API_BASE_URL', {
|
||||
value: 'http://localhost:8080/api/v1',
|
||||
writable: true,
|
||||
});
|
||||
|
||||
// Mock matchMedia - required for Mantine components
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: 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(),
|
||||
})),
|
||||
});
|
||||
|
||||
// Mock ResizeObserver - sometimes needed for Mantine components
|
||||
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
||||
observe: vi.fn(),
|
||||
unobserve: vi.fn(),
|
||||
disconnect: vi.fn(),
|
||||
}));
|
||||
Reference in New Issue
Block a user