Fix build

This commit is contained in:
Deluan 2023-05-17 13:49:45 -04:00
parent bfa10cab62
commit d85b06332c

View file

@ -4,17 +4,24 @@
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect'
class LocalStorageMock {
constructor() {
this.store = {}
}
getItem(key) {
return this.store[key] || null
}
setItem(key, value) {
this.store[key] = String(value)
}
}
const localStorageMock = (function () {
let store = {}
return {
getItem: function (key) {
return store[key] || null
},
setItem: function (key, value) {
store[key] = value.toString()
},
clear: function () {
store = {}
},
}
})()
Object.defineProperty(window, 'localStorage', {
value: localStorageMock,
})
global.localStorage = new LocalStorageMock()
localStorage.setItem('username', 'admin')