diff options
Diffstat (limited to 'vid-webpack-master/src/jestGlobalMocks.ts')
-rw-r--r-- | vid-webpack-master/src/jestGlobalMocks.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vid-webpack-master/src/jestGlobalMocks.ts b/vid-webpack-master/src/jestGlobalMocks.ts new file mode 100644 index 000000000..5486d7c9a --- /dev/null +++ b/vid-webpack-master/src/jestGlobalMocks.ts @@ -0,0 +1,15 @@ +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'] +}); |