Skip to content

Commit 5fcb4d7

Browse files
authored
test(query-persist-client-core/persist): add test for removing a cache without a timestamp in 'persistQueryClientRestore' (TanStack#10877)
1 parent 89bae56 commit 5fcb4d7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/query-persist-client-core/src/__tests__/persist.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,21 @@ describe('persist', () => {
211211

212212
expect(persister.removeClient).toHaveBeenCalledTimes(1)
213213
})
214+
215+
it('should remove the client when the persisted cache has no timestamp', async () => {
216+
persister.restoreClient = () =>
217+
Promise.resolve({
218+
buster: '',
219+
clientState: { mutations: [], queries: [] },
220+
timestamp: 0,
221+
})
222+
223+
await persistQueryClientRestore({
224+
queryClient,
225+
persister,
226+
})
227+
228+
expect(persister.removeClient).toHaveBeenCalledTimes(1)
229+
})
214230
})
215231
})

0 commit comments

Comments
 (0)