extending card context test

This commit is contained in:
Roland Osborne 2023-01-08 15:00:24 -08:00
parent 5ab3e9ee7a
commit 51d2014aa9

View File

@ -113,6 +113,44 @@ afterEach(() => {
fetchUtil.fetchWithCustomTimeout = realFetchWithCustomTimeout;
});
test('resync cards', async() => {
render(<CardTestApp />);
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(<CardTestApp />);