From 5e7a5d2cdba870e2ed6b4b92e05562b6ad90b14b Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Tue, 17 Oct 2023 14:42:21 -0600 Subject: [PATCH] Update test that checks changes to context between renders --- src/react/hooks/__tests__/useInteractiveQuery.test.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/react/hooks/__tests__/useInteractiveQuery.test.tsx b/src/react/hooks/__tests__/useInteractiveQuery.test.tsx index 14ac640ded4..04dbb027571 100644 --- a/src/react/hooks/__tests__/useInteractiveQuery.test.tsx +++ b/src/react/hooks/__tests__/useInteractiveQuery.test.tsx @@ -2025,7 +2025,7 @@ it("applies `context` on next fetch when it changes between renders", async () = const user = userEvent.setup(); - const query: TypedDocumentNode = gql` + const query: TypedDocumentNode = gql` query { context } @@ -2050,7 +2050,7 @@ it("applies `context` on next fetch when it changes between renders", async () = function Parent() { const [phase, setPhase] = React.useState("initial"); - const [queryRef, { refetch }] = useInteractiveQuery(query, { + const [queryRef, loadQuery, { refetch }] = useInteractiveQuery(query, { context: { phase }, }); @@ -2058,8 +2058,9 @@ it("applies `context` on next fetch when it changes between renders", async () = <> + }> - + {queryRef && } ); @@ -2081,6 +2082,8 @@ it("applies `context` on next fetch when it changes between renders", async () = render(); + await act(() => user.click(screen.getByText("Load query"))); + expect(await screen.findByTestId("context")).toHaveTextContent("initial"); await act(() => user.click(screen.getByText("Update context")));