mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-11-10 13:44:45 +00:00
1718c7cedb
update main,js to rquire localStroage, add simple unit tests to localStroage.test.js, create symlink of testenv.js to source/assets/scripts, update package.json with proper recursive call Signed-off-by: Arthur Lu <learthurgo@gmail.com>
28 lines
479 B
JavaScript
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;
|
|
} |