fix: restore mock cleanup in tests

mockRestore() calls are needed for these specific mocks
This commit is contained in:
bymyself
2026-01-20 14:03:57 -08:00
parent 5b6cc8777e
commit f44c06f16b

View File

@@ -59,21 +59,25 @@ describe('workflowSessionStorageService', () => {
})
it('returns false after max eviction attempts', () => {
vi.spyOn(sessionStorage, 'setItem').mockImplementation(() => {
const spy = vi.spyOn(sessionStorage, 'setItem').mockImplementation(() => {
throw new DOMException('Quota exceeded', 'QuotaExceededError')
})
const result = setWithEviction('key', { test: 'data' })
expect(result).toBe(false)
spy.mockRestore()
})
it('returns false on unexpected errors', () => {
vi.spyOn(sessionStorage, 'setItem').mockImplementation(() => {
const spy = vi.spyOn(sessionStorage, 'setItem').mockImplementation(() => {
throw new Error('Unexpected error')
})
const result = setWithEviction('key', { test: 'data' })
expect(result).toBe(false)
spy.mockRestore()
})
})