-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
49 lines (45 loc) · 1.04 KB
/
jest.setup.js
File metadata and controls
49 lines (45 loc) · 1.04 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
import '@testing-library/jest-dom'
// Mock Firebase
jest.mock('@/lib/firebase', () => ({
auth: {
currentUser: { uid: 'test-uid', email: 'test@example.com' },
onAuthStateChanged: jest.fn(),
signInWithEmailAndPassword: jest.fn(),
createUserWithEmailAndPassword: jest.fn(),
signOut: jest.fn(),
},
db: {},
}))
// Mock Next.js router
jest.mock('next/navigation', () => ({
useRouter: () => ({
push: jest.fn(),
replace: jest.fn(),
back: jest.fn(),
forward: jest.fn(),
refresh: jest.fn(),
prefetch: jest.fn(),
}),
useParams: () => ({}),
}))
// Mock Firebase Firestore
jest.mock('firebase/firestore', () => ({
collection: jest.fn(),
doc: jest.fn(),
getDoc: jest.fn(),
getDocs: jest.fn(),
addDoc: jest.fn(),
updateDoc: jest.fn(),
serverTimestamp: jest.fn(() => new Date()),
query: jest.fn(),
where: jest.fn(),
}))
// Mock console methods to reduce noise in tests
global.console = {
...console,
log: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
}