cse110-fa22-group29/testenv/testenv.js
Arthur Lu a6015aff3b implement basic linting with eslint,
fix linting errors in testenv module

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
2022-11-08 03:09:10 +00:00

28 lines
479 B
JavaScript

module.exports = {environment};
function environment () {
const localStorageMock = (function () {
let store = {};
return {
getItem(key) {
return store[key];
},
setItem(key, value) {
store[key] = value;
},
clear() {
store = {};
},
removeItem(key) {
delete store[key];
},
getAll() {
return store;
},
};
})();
let window = {};
Object.defineProperty(window, "localStorage", { value: localStorageMock });
return window;
}