Skip to content

Commit

Permalink
test(usePersistedStateReducer): await act in other retry logic test
Browse files Browse the repository at this point in the history
  • Loading branch information
KaylaBrady committed Aug 17, 2023
1 parent 0a00c2a commit 656984e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions assets/tests/hooks/usePersistedStateReducer.test.ts
Original file line number Diff line number Diff line change
@@ -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, {
Expand Down Expand Up @@ -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,
Expand All @@ -358,7 +355,6 @@ describe("usePersistedStateReducer", () => {
expect(state.routeTabsToPush).toBeNull()
expect(state.routeTabsToPushNext).toBeNull()
expect(state.routeTabsPushInProgress).toEqual(false)
expect(putRouteTabs).toHaveBeenCalledTimes(3)
})
})

Expand Down

0 comments on commit 656984e

Please sign in to comment.