-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup-tests.ts
More file actions
54 lines (51 loc) · 1.2 KB
/
Copy pathsetup-tests.ts
File metadata and controls
54 lines (51 loc) · 1.2 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
// Jest setup file for global test configuration
// Mock chrome APIs for extension testing
const mockChrome = {
storage: {
local: {
get: jest.fn(),
set: jest.fn(),
remove: jest.fn(),
clear: jest.fn(),
},
sync: {
get: jest.fn(),
set: jest.fn(),
remove: jest.fn(),
clear: jest.fn(),
},
},
runtime: {
getURL: jest.fn((path: string) => `chrome-extension://test-id/${path}`),
getManifest: jest.fn(() => ({
name: "Test Extension",
version: "1.0.0",
update_url: undefined,
})),
},
extension: {
getURL: jest.fn((path: string) => `chrome-extension://test-id/${path}`),
getBackgroundPage: jest.fn(() => null),
},
};
// Make chrome available globally
(global as any).chrome = mockChrome;
// Mock console methods to reduce noise in tests
global.console = {
...console,
// Uncomment to ignore specific console methods
log: jest.fn(),
group: jest.fn(),
groupCollapsed: jest.fn(),
groupEnd: jest.fn(),
time: jest.fn(),
timeEnd: jest.fn(),
timeLog: jest.fn(),
profile: jest.fn(),
profileEnd: jest.fn(),
table: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
};