17 lines
383 B
JavaScript
17 lines
383 B
JavaScript
import { jsdom } from 'jsdom';
|
|
|
|
global.document = jsdom('<!doctype html><html><body></body></html>');
|
|
global.window = document.defaultView;
|
|
global.navigator = global.window.navigator;
|
|
window.localStorage = window.sessionStorage = {
|
|
getItem(key) {
|
|
return this[key];
|
|
},
|
|
setItem(key, value) {
|
|
this[key] = value;
|
|
},
|
|
removeItem(key) {
|
|
this[key] = undefined;
|
|
},
|
|
};
|