cookie-dialog-monster/packages/browser-extension/mocks/chrome.mock.ts

33 lines
766 B
TypeScript

import { jest } from '@jest/globals';
chrome.action = {
...chrome.action,
openPopup: jest.fn(),
setBadgeBackgroundColor: jest.fn(),
setBadgeText: jest.fn(),
setIcon: jest.fn(),
} as typeof chrome.action;
chrome.contextMenus = {
...chrome.contextMenus,
create: jest.fn(),
removeAll: jest.fn(),
} as typeof chrome.contextMenus;
chrome.declarativeNetRequest = {
...chrome.declarativeNetRequest,
updateSessionRules: jest.fn(),
} as typeof chrome.declarativeNetRequest;
chrome.runtime = {
...chrome.runtime,
getManifest: jest.fn(
() =>
({
content_scripts: [{ matches: ['https://example.com/*'] }],
version: '1.0.0',
}) as chrome.runtime.ManifestV3
),
openOptionsPage: jest.fn(),
} as typeof chrome.runtime;