forked from jorgenbuilder/ic-inspector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.test.ts
31 lines (26 loc) · 1.24 KB
/
jest.setup.test.ts
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
// import { chrome as jestChrome } from 'jest-chrome';
test('browser is defined in the global scope', () => {
expect(browser).toBeDefined();
expect(browser.runtime).toBeDefined();
// This will be undefined if no mock implementation is provided
expect(browser.runtime.sendMessage).toBeUndefined();
});
// test('browser api methods are defined after implementation in chrome api', () => {
// // You need to add an implementation for each Chrome API method you use
// // Methods will be present in the Chrome API without implementations
// // but unused methods in the Browser API will be undefined
// jestChrome.runtime.sendMessage.mockImplementation((message, cb) => {
// cb({ greeting: 'test-response' });
// });
// expect(browser.runtime.sendMessage).toBeDefined();
// });
test('chrome is mocked in the global scope', () => {
expect(chrome).toBeDefined();
expect(chrome.runtime).toBeDefined();
expect(chrome.runtime.sendMessage).toBeDefined();
});
test('chrome devtools is mocked in the global scope', async () => {
expect(chrome.devtools).toBeDefined();
expect(chrome.devtools.network).toBeDefined();
expect(chrome.devtools.network.onRequestFinished.addListener).toBeDefined();
});