forked from lentrekin1/devmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
37 lines (33 loc) · 827 Bytes
/
jest.setup.js
File metadata and controls
37 lines (33 loc) · 827 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
37
import '@testing-library/jest-dom'
// Mock environment variables for testing
process.env.OPENAI_API_KEY = 'test-key'
process.env.DATABASE_URL = 'postgresql://test:test@localhost:5432/test'
process.env.PINECONE_API_KEY = 'test-pinecone-key'
process.env.PINECONE_ENVIRONMENT = 'test-env'
// Mock Next.js router
jest.mock('next/navigation', () => ({
useRouter() {
return {
push: jest.fn(),
replace: jest.fn(),
prefetch: jest.fn(),
}
},
useSearchParams() {
return new URLSearchParams()
},
usePathname() {
return ''
},
}))
// Mock Pinecone
jest.mock('pinecone-database', () => ({
Pinecone: jest.fn().mockImplementation(() => ({
Index: jest.fn().mockReturnValue({
query: jest.fn(),
upsert: jest.fn(),
}),
})),
}))
// Global test timeout
jest.setTimeout(10000)