From 656984e1fbc5dfd8a66a575ea070fef8d6081c24 Mon Sep 17 00:00:00 2001 From: KaylaBrady <31781298+KaylaBrady@users.noreply.github.com> Date: Thu, 17 Aug 2023 10:52:01 -0400 Subject: [PATCH] test(usePersistedStateReducer): await act in other retry logic test --- assets/tests/hooks/usePersistedStateReducer.test.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/assets/tests/hooks/usePersistedStateReducer.test.ts b/assets/tests/hooks/usePersistedStateReducer.test.ts index 9aa565c50..8fd3439f2 100644 --- a/assets/tests/hooks/usePersistedStateReducer.test.ts +++ b/assets/tests/hooks/usePersistedStateReducer.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, waitFor } from "@testing-library/react" +import { act, renderHook } from "@testing-library/react" import { putUserSetting, putRouteTabs } from "../../src/api" import appData from "../../src/appData" import usePersistedStateReducer, { @@ -339,16 +339,13 @@ describe("usePersistedStateReducer", () => { .mockImplementationOnce(() => fakePromise) .mockImplementationOnce(() => fakePromise) - act(() => { + await act(async () => { dispatch(createRouteTab()) }) - const initialValue = result.current - await waitFor(() => { - expect(result.current).not.toBe(initialValue) - }) const [state] = result.current + expect(putRouteTabs).toHaveBeenCalledTimes(3) expect(state.routeTabs).toMatchObject([ { ordering: 0, @@ -358,7 +355,6 @@ describe("usePersistedStateReducer", () => { expect(state.routeTabsToPush).toBeNull() expect(state.routeTabsToPushNext).toBeNull() expect(state.routeTabsPushInProgress).toEqual(false) - expect(putRouteTabs).toHaveBeenCalledTimes(3) }) })