Browse Source

fix: tests polyfill

tophf 4 years ago
parent
commit
c62a54ad89
1 changed files with 5 additions and 1 deletions
  1. 5 1
      test/mock/polyfill.js

+ 5 - 1
test/mock/polyfill.js

@@ -2,7 +2,6 @@ import tldRules from 'tldjs/rules.json';
 import { JSDOM } from 'jsdom';
 
 global.window = new JSDOM('').window;
-global.chrome = {};
 global.browser = {
   storage: {
     local: {
@@ -20,6 +19,11 @@ global.browser = {
     getURL: path => path,
   },
 };
+global.chrome = {
+  runtime: {
+    getURL: browser.runtime.getURL,
+  },
+};
 if (!window.Response) window.Response = { prototype: {} };
 const domProps = Object.getOwnPropertyDescriptors(window);
 for (const k of Object.keys(domProps)) {