diff --git a/net/web/test/Card.test.js b/net/web/test/Card.test.js index da69f080..24f0547e 100644 --- a/net/web/test/Card.test.js +++ b/net/web/test/Card.test.js @@ -113,6 +113,44 @@ afterEach(() => { fetchUtil.fetchWithCustomTimeout = realFetchWithCustomTimeout; }); +test('resync cards', async() => { + + render(); + + await waitFor(async () => { + expect(cardContext).not.toBe(null); + }); + + await act(async () => { + cardContext.actions.setToken('abc123'); + }); + + statusCards = 500; + + await act(async () => { + cardContext.actions.setRevision(1); + }); + + await waitFor(async () => { + expect(screen.getByTestId('cards').attributes.offsync.value).toBe('true'); + }); + + statusCards = 200; + + await act(async () => { + cardContext.actions.resync(); + }); + + await waitFor(async () => { + expect(screen.getByTestId('cards').attributes.offsync.value).toBe('false'); + }); + + act(() => { + cardContext.actions.clearToken(); + }); + +}); + test('add, update, remove card', async () => { render();