-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
31 lines (30 loc) · 769 Bytes
/
vitest.setup.ts
File metadata and controls
31 lines (30 loc) · 769 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
/* eslint-disable no-undef, @typescript-eslint/no-explicit-any */
// Mock browser API for tests
global.browser = {
storage: {
sync: {
get: vi.fn(),
set: vi.fn(),
getBytesInUse: vi.fn().mockResolvedValue(0),
},
onChanged: {
addListener: vi.fn(),
removeListener: vi.fn(),
},
},
tabs: {
query: vi.fn(),
sendMessage: vi.fn(),
},
runtime: {
getURL: vi.fn((path: string) => `chrome-extension://mock-id/${path}`),
onMessage: {
addListener: vi.fn(),
removeListener: vi.fn(),
},
onInstalled: {
addListener: vi.fn(),
removeListener: vi.fn(),
},
},
} as any;