-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
36 lines (33 loc) · 856 Bytes
/
vitest.setup.ts
File metadata and controls
36 lines (33 loc) · 856 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 { vi } from 'vitest'
// Mock Firebase modules globally
vi.mock('./lib/firebase', () => ({
auth: { currentUser: null, onAuthStateChanged: vi.fn() },
db: {},
}))
vi.mock('firebase/auth', () => ({
getAuth: vi.fn(),
GoogleAuthProvider: vi.fn(),
signInWithPopup: vi.fn(),
signOut: vi.fn(),
onAuthStateChanged: vi.fn(),
}))
vi.mock('firebase/firestore', () => ({
getFirestore: vi.fn(),
collection: vi.fn(),
doc: vi.fn(),
addDoc: vi.fn(),
updateDoc: vi.fn(),
deleteDoc: vi.fn(),
getDoc: vi.fn(),
getDocs: vi.fn(),
query: vi.fn(),
where: vi.fn(),
orderBy: vi.fn(),
onSnapshot: vi.fn(),
serverTimestamp: vi.fn(() => new Date()),
Timestamp: { now: vi.fn(() => ({ toDate: () => new Date() })) },
increment: vi.fn((n) => n),
runTransaction: vi.fn(),
writeBatch: vi.fn(),
}))