cse110-fa22-group29/testenv/testenv_helpers.js
Arthur Lu 3043c6e157 fix locality issue in mocha unit tests,
move sample helper functions for localStorage unit testing

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
2022-11-08 01:33:35 +00:00

17 lines
343 B
JavaScript

module.exports = {saveToLocal, getFromLocal, removeFromLocal, clearLocal};
function saveToLocal (k, v) {
window.localStorage.setItem(k, v);
}
function getFromLocal (k) {
return window.localStorage.getItem(k);
}
function removeFromLocal (k) {
window.localStorage.removeItem(k);
}
function clearLocal () {
window.localStorage.clear();
}