From 51d2014aa9e81879c4666a0ec74c7446243446f8 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Sun, 8 Jan 2023 15:00:24 -0800 Subject: [PATCH] extending card context test --- net/web/test/Card.test.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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();