klimentru1986 4ca019ac02 lint
2018-05-06 02:17:16 +03:00

19 lines
491 B
TypeScript

const mock = () => {
let storage = {};
return {
getItem: key => (key in storage ? storage[key] : null),
setItem: (key, value) => (storage[key] = value || ''),
removeItem: key => delete storage[key],
clear: () => (storage = {}),
};
};
Object.defineProperty(window, 'localStorage', {
value: mock(),
});
Object.defineProperty(window, 'sessionStorage', {
value: mock(),
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => ['-webkit-appearance'],
});