mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +03:00
Fix build
This commit is contained in:
parent
bfa10cab62
commit
d85b06332c
1 changed files with 19 additions and 12 deletions
|
@ -4,17 +4,24 @@
|
||||||
// learn more: https://github.com/testing-library/jest-dom
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
import '@testing-library/jest-dom/extend-expect'
|
import '@testing-library/jest-dom/extend-expect'
|
||||||
|
|
||||||
class LocalStorageMock {
|
const localStorageMock = (function () {
|
||||||
constructor() {
|
let store = {}
|
||||||
this.store = {}
|
|
||||||
}
|
return {
|
||||||
getItem(key) {
|
getItem: function (key) {
|
||||||
return this.store[key] || null
|
return store[key] || null
|
||||||
}
|
},
|
||||||
setItem(key, value) {
|
setItem: function (key, value) {
|
||||||
this.store[key] = String(value)
|
store[key] = value.toString()
|
||||||
}
|
},
|
||||||
}
|
clear: function () {
|
||||||
|
store = {}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
|
Object.defineProperty(window, 'localStorage', {
|
||||||
|
value: localStorageMock,
|
||||||
|
})
|
||||||
|
|
||||||
global.localStorage = new LocalStorageMock()
|
|
||||||
localStorage.setItem('username', 'admin')
|
localStorage.setItem('username', 'admin')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue