mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 10:59:53 +00:00
fix: restore mock cleanup in tests
mockRestore() calls are needed for these specific mocks
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user