mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-06 21:36:29 +02:00
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.
This commit is contained in:
21
tests/__mocks__/browserMocks.js
Normal file
21
tests/__mocks__/browserMocks.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// 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
|
||||
}); */
|
3
tests/__mocks__/fileMocks.js
Normal file
3
tests/__mocks__/fileMocks.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This fixed an error related to the CSS and loading gif breaking my Jest test
|
||||
// See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
|
||||
module.exports = 'test-file-stub';
|
Reference in New Issue
Block a user