-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
59 lines (56 loc) · 1.05 KB
/
vitest.setup.ts
File metadata and controls
59 lines (56 loc) · 1.05 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
50
51
52
53
54
55
56
57
58
59
import { vi } from "vitest";
const createEvent = () => ({
addListener: vi.fn(),
removeListener: vi.fn(),
hasListener: vi.fn(),
});
const chromeMock = {
bookmarks: {
create: vi.fn(),
get: vi.fn(),
getChildren: vi.fn(),
getTree: vi.fn(),
move: vi.fn(),
remove: vi.fn(),
removeTree: vi.fn(),
search: vi.fn(),
update: vi.fn(),
onChanged: createEvent(),
onCreated: createEvent(),
onMoved: createEvent(),
onRemoved: createEvent(),
},
runtime: {
connect: vi.fn(),
lastError: null,
onInstalled: createEvent(),
onMessage: createEvent(),
sendMessage: vi.fn(),
},
storage: {
local: {
clear: vi.fn(),
get: vi.fn(),
remove: vi.fn(),
set: vi.fn(),
},
sync: {
clear: vi.fn(),
get: vi.fn(),
remove: vi.fn(),
set: vi.fn(),
},
},
tabs: {
create: vi.fn(),
query: vi.fn(),
update: vi.fn(),
onUpdated: createEvent(),
},
windows: {
create: vi.fn(),
},
};
Object.assign(globalThis, {
chrome: chromeMock,
});