From 391cb947b933e195a12c2836aaa049b7b8013b9f Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Tue, 19 Mar 2024 15:16:27 -0600 Subject: [PATCH] Update failing tests in useQueryRefHandlers --- .../__tests__/useQueryRefHandlers.test.tsx | 65 +++++++++++++++++-- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/src/react/hooks/__tests__/useQueryRefHandlers.test.tsx b/src/react/hooks/__tests__/useQueryRefHandlers.test.tsx index a7f2dd72f43..a81c64d8373 100644 --- a/src/react/hooks/__tests__/useQueryRefHandlers.test.tsx +++ b/src/react/hooks/__tests__/useQueryRefHandlers.test.tsx @@ -1100,7 +1100,18 @@ test("resuspends when calling `fetchMore`", async () => { const user = userEvent.setup(); - const client = new ApolloClient({ cache: new InMemoryCache(), link }); + const client = new ApolloClient({ + cache: new InMemoryCache({ + typePolicies: { + Query: { + fields: { + letters: { keyArgs: false }, + }, + }, + }, + }), + link, + }); const preloadQuery = createQueryPreloader(client); const Profiler = createProfiler({ @@ -1397,7 +1408,18 @@ test("paginates from queryRefs produced by useBackgroundQuery", async () => { const { query, link } = setupPaginatedCase(); const user = userEvent.setup(); - const client = new ApolloClient({ cache: new InMemoryCache(), link }); + const client = new ApolloClient({ + cache: new InMemoryCache({ + typePolicies: { + Query: { + fields: { + letters: { keyArgs: false }, + }, + }, + }, + }), + link, + }); const Profiler = createProfiler({ initialSnapshot: { @@ -1489,7 +1511,18 @@ test("paginates from queryRefs produced by useLoadableQuery", async () => { const { query, link } = setupPaginatedCase(); const user = userEvent.setup(); - const client = new ApolloClient({ cache: new InMemoryCache(), link }); + const client = new ApolloClient({ + cache: new InMemoryCache({ + typePolicies: { + Query: { + fields: { + letters: { keyArgs: false }, + }, + }, + }, + }), + link, + }); const Profiler = createProfiler({ initialSnapshot: { @@ -1589,7 +1622,18 @@ test("`fetchMore` works with startTransition", async () => { const { query, link } = setupPaginatedCase(); const user = userEvent.setup(); - const client = new ApolloClient({ cache: new InMemoryCache(), link }); + const client = new ApolloClient({ + cache: new InMemoryCache({ + typePolicies: { + Query: { + fields: { + letters: { keyArgs: false }, + }, + }, + }, + }), + link, + }); const preloadQuery = createQueryPreloader(client); const Profiler = createProfiler({ @@ -1708,7 +1752,18 @@ test("`fetchMore` works with startTransition from useBackgroundQuery and useQuer const { query, link } = setupPaginatedCase(); const user = userEvent.setup(); - const client = new ApolloClient({ cache: new InMemoryCache(), link }); + const client = new ApolloClient({ + cache: new InMemoryCache({ + typePolicies: { + Query: { + fields: { + letters: { keyArgs: false }, + }, + }, + }, + }), + link, + }); const Profiler = createProfiler({ initialSnapshot: {