mirror of
https://github.com/balzack/databag.git
synced 2025-02-11 19:19:16 +00:00
extending card context test
This commit is contained in:
parent
5ab3e9ee7a
commit
51d2014aa9
@ -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 />);
|
||||
|
Loading…
Reference in New Issue
Block a user