Roo-Code/apps/web/vitest.setup.client.ts
Roo Code 96a1fc0a49 Fix TypeScript errors in test files
- Fixed vitest matcher usage: replaced toBeTypeOf with typeof + toBe
- Fixed import statements for fs and path modules to use namespace imports
- Resolves TypeScript compilation errors preventing push

Part of fixing test setup issues for PR #227
2025-07-08 12:34:55 +00:00

32 lines
798 B
TypeScript

import '@testing-library/jest-dom';
// Mock ResizeObserver
globalThis.ResizeObserver = vi.fn().mockImplementation(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
}));
// Mock IntersectionObserver
globalThis.IntersectionObserver = vi.fn().mockImplementation(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
}));
// Mock matchMedia for next-themes
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // deprecated
removeListener: vi.fn(), // deprecated
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});
beforeEach(() => vi.clearAllMocks());