jest-webextension-mock
Advanced tools
Comparing version 3.8.8 to 3.8.9
@@ -32,5 +32,6 @@ beforeEach(() => { | ||
const path = 'TEST_PATH'; | ||
const extensionOriginURL = globalThis[Symbol.for('jest-webextension-mock')].extensionPath; | ||
expect(jest.isMockFunction(browser.runtime.getURL)).toBe(true); | ||
const respPath = browser.runtime.getURL(path); | ||
expect(respPath).toEqual(path); | ||
expect(respPath).toEqual(extensionOriginURL + path); | ||
expect(browser.runtime.getURL).toHaveBeenCalledTimes(1); | ||
@@ -37,0 +38,0 @@ }); |
'use strict'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
// https://developer.chrome.com/extensions/omnibox | ||
@@ -87,3 +138,4 @@ var omnibox = { | ||
getURL: jest.fn(function (path) { | ||
return path; | ||
var origin = globalThis[Symbol["for"]('jest-webextension-mock')].extensionPath; | ||
return String(new URL(path, origin)); | ||
}), | ||
@@ -194,12 +246,2 @@ openOptionsPage: jest.fn(), | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
var store = {}; | ||
@@ -568,2 +610,5 @@ | ||
globalThis[Symbol["for"]('jest-webextension-mock')] = _objectSpread2({ | ||
extensionPath: 'moz-extension://8b413e68-1e0d-4cad-b98e-1eb000799783/' | ||
}, globalThis[Symbol["for"]('jest-webextension-mock')]); | ||
var chrome = { | ||
@@ -570,0 +615,0 @@ omnibox: omnibox, |
{ | ||
"name": "jest-webextension-mock", | ||
"version": "3.8.8", | ||
"version": "3.8.9", | ||
"description": "Mock the components of a WebExtension", | ||
@@ -5,0 +5,0 @@ "main": "dist/setup.js", |
@@ -16,2 +16,7 @@ import { omnibox } from './omnibox'; | ||
globalThis[Symbol.for('jest-webextension-mock')] = { | ||
extensionPath: 'moz-extension://8b413e68-1e0d-4cad-b98e-1eb000799783/', | ||
...globalThis[Symbol.for('jest-webextension-mock')] | ||
}; | ||
const chrome = { | ||
@@ -18,0 +23,0 @@ omnibox, |
@@ -59,3 +59,4 @@ export let onMessageListeners = []; | ||
getURL: jest.fn(function (path) { | ||
return path; | ||
const origin = globalThis[Symbol.for('jest-webextension-mock')].extensionPath; | ||
return String(new URL(path, origin)); | ||
}), | ||
@@ -62,0 +63,0 @@ openOptionsPage: jest.fn(), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75501
2003