1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-06-20 06:29:18 +02:00
Files
php-web-maker/tests/__mocks__/browserMocks.js
Kushagra Gour 37d8e9801a refactor tests and babel config. Fixes target browsers.
This is basically the change propagated from the current
default preact tempalate. Now the code compiles according to set
browsers.
2018-10-21 19:18:53 +05:30

22 lines
466 B
JavaScript

// Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage
/**
* An example how to mock localStorage is given below 👇
*/
/*
// Mocks localStorage
const localStorageMock = (function() {
let store = {};
return {
getItem: (key) => store[key] || null,
setItem: (key, value) => store[key] = value.toString(),
clear: () => store = {}
};
})();
Object.defineProperty(window, 'localStorage', {
value: localStorageMock
}); */