-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
36 lines (33 loc) · 852 Bytes
/
vitest.setup.ts
File metadata and controls
36 lines (33 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import '@testing-library/jest-dom';
import React from 'react';
import { vi } from 'vitest';
// Mock Next.js router
vi.mock('next/navigation', () => ({
useRouter: () => ({
push: vi.fn(),
replace: vi.fn(),
prefetch: vi.fn(),
back: vi.fn(),
}),
usePathname: () => '/',
useSearchParams: () => new URLSearchParams(),
}));
// Mock next-themes
vi.mock('next-themes', () => ({
useTheme: vi.fn(() => ({
theme: 'light',
setTheme: vi.fn(),
resolvedTheme: 'light',
})),
ThemeProvider: ({ children }: { children: React.ReactNode }) => children,
}));
// Mock framer-motion to avoid animation issues in tests
vi.mock('framer-motion', () => ({
motion: {
div: ({ children, ...props }: any) => React.createElement('div', props, children),
},
useAnimation: () => ({
start: vi.fn(),
stop: vi.fn(),
}),
}));