Skip to content

Commit

Permalink
fix: SafeLocalStorage.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
magiziz committed Sep 23, 2024
1 parent b1d74e5 commit aa52010
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/common/tests/SafeLocalStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('SafeLocalStorage unsafe', () => {
describe('SafeLocalStorage safe', () => {
let getItem = vi.fn(value => {
if (value === '@appkit/wallet_id') {
return 'test'
return JSON.stringify('test')
}

return undefined
Expand All @@ -38,15 +38,10 @@ describe('SafeLocalStorage safe', () => {
Object.assign(globalThis, { window: {}, localStorage: { getItem, setItem, removeItem } })
})

afterAll(() => {
getItem.mockClear()
setItem.mockClear()
removeItem.mockClear()
})


it('should setItem', () => {
expect(SafeLocalStorage.setItem('@appkit/wallet_id', 'test')).toBe(undefined)
expect(setItem).toHaveBeenCalledWith('@appkit/wallet_id', 'test')
expect(setItem).toHaveBeenCalledWith('@appkit/wallet_id', JSON.stringify('test'))
})

it('should getItem ', () => {
Expand Down

0 comments on commit aa52010

Please sign in to comment.