mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-12-28 01:39:09 +00:00
ec305e667d
remove framework unittest, add helper module to create unit testing environment
28 lines
506 B
JavaScript
28 lines
506 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;
|
|
} |