Fix quick actions not working when nonexisting lists where left over in history
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {getHistory, saveListToHistory} from './listHistory'
|
||||
import {getHistory, removeListFromHistory, saveListToHistory} from './listHistory'
|
||||
|
||||
test('return an empty history when none was saved', () => {
|
||||
Storage.prototype.getItem = jest.fn(() => null)
|
||||
@ -65,3 +65,17 @@ test('move a list to the beginning when storing it multiple times', () => {
|
||||
saveListToHistory({id: 1})
|
||||
expect(saved).toBe('[{"id":1},{"id":2}]')
|
||||
})
|
||||
|
||||
test('remove list from history', () => {
|
||||
let saved: string | null = '[{"id": 1}]'
|
||||
Storage.prototype.getItem = jest.fn(() => null)
|
||||
Storage.prototype.setItem = jest.fn((key: string, lists: string) => {
|
||||
saved = lists
|
||||
})
|
||||
Storage.prototype.removeItem = jest.fn((key: string) => {
|
||||
saved = null
|
||||
})
|
||||
|
||||
removeListFromHistory({id: 1})
|
||||
expect(saved).toBeNull()
|
||||
})
|
||||
|
Reference in New Issue
Block a user