-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
35 lines (28 loc) · 807 Bytes
/
jest.setup.js
File metadata and controls
35 lines (28 loc) · 807 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
import '@testing-library/jest-dom'
// Mock environment variables for tests
process.env.NEXT_PUBLIC_API_BASE_URL = 'http://localhost:3000'
process.env.NEXT_PUBLIC_ENVIRONMENT = 'test'
// Mock fetch for tests
global.fetch = jest.fn()
// Mock IntersectionObserver
global.IntersectionObserver = jest.fn().mockImplementation(() => ({
observe: jest.fn(),
disconnect: jest.fn(),
unobserve: jest.fn(),
}))
// Mock ResizeObserver
global.ResizeObserver = jest.fn().mockImplementation(() => ({
observe: jest.fn(),
disconnect: jest.fn(),
unobserve: jest.fn(),
}))
// Mock requestAnimationFrame
global.requestAnimationFrame = jest.fn((callback) => {
setTimeout(callback, 0)
return 0
})
global.cancelAnimationFrame = jest.fn()
// Clean up after each test
afterEach(() => {
jest.clearAllMocks()
})