From 5fe3bccde4942fc69731db5bbb864b0debb047df Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Mon, 25 Nov 2024 15:29:06 -0700 Subject: [PATCH] Ensure tests include __typename in types --- src/react/hooks/__tests__/useBackgroundQuery.test.tsx | 1 + src/react/hooks/__tests__/useLazyQuery.test.tsx | 2 ++ src/react/hooks/__tests__/useMutation.test.tsx | 1 + src/react/hooks/__tests__/useQuery.test.tsx | 1 + src/react/hooks/__tests__/useSubscription.test.tsx | 1 + src/react/hooks/__tests__/useSuspenseQuery.test.tsx | 4 ++++ src/testing/internal/scenarios/index.ts | 1 + 7 files changed, 11 insertions(+) diff --git a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx index e53a1519c84..84b16b813c8 100644 --- a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx +++ b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx @@ -4789,6 +4789,7 @@ it("masks cache and network result when using cache-and-network fetch policy", a it("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useLazyQuery.test.tsx b/src/react/hooks/__tests__/useLazyQuery.test.tsx index 5589db55364..bd7bffe87ef 100644 --- a/src/react/hooks/__tests__/useLazyQuery.test.tsx +++ b/src/react/hooks/__tests__/useLazyQuery.test.tsx @@ -2502,6 +2502,7 @@ describe.skip("Type Tests", () => { test("uses masked types when using masked document", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; @@ -2600,6 +2601,7 @@ describe.skip("Type Tests", () => { test("uses unmasked types when using TypedDocumentNode", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useMutation.test.tsx b/src/react/hooks/__tests__/useMutation.test.tsx index 269ba281cfb..c4098cc571a 100644 --- a/src/react/hooks/__tests__/useMutation.test.tsx +++ b/src/react/hooks/__tests__/useMutation.test.tsx @@ -3242,6 +3242,7 @@ describe.skip("Type Tests", () => { test("uses masked/unmasked type when using Masked", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName": "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useQuery.test.tsx b/src/react/hooks/__tests__/useQuery.test.tsx index 84f985f0d46..003f1899f0c 100644 --- a/src/react/hooks/__tests__/useQuery.test.tsx +++ b/src/react/hooks/__tests__/useQuery.test.tsx @@ -10898,6 +10898,7 @@ describe("useQuery Hook", () => { it("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index bfc55ebb8d0..058fc277ce8 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -2419,6 +2419,7 @@ describe.skip("Type Tests", () => { test("uses unmasked types when using TypedDocumentNode", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx index 6817ad2f59d..3583243f787 100644 --- a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx +++ b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx @@ -286,17 +286,20 @@ function useVariablesQueryCase() { } type CharacterFragment = { + __typename: "Character"; name: string; } & { " $fragmentName"?: "CharacterFragment" }; interface MaskedVariablesCaseData { character: { + __typename: "Character"; id: string; } & { " $fragmentRefs"?: { CharacterFragment: CharacterFragment } }; } interface UnmaskedVariablesCaseData { character: { + __typename: "Character"; id: string; name: string; }; @@ -11461,6 +11464,7 @@ describe("useSuspenseQuery", () => { it("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/testing/internal/scenarios/index.ts b/src/testing/internal/scenarios/index.ts index fc266ff3685..0d9a826521a 100644 --- a/src/testing/internal/scenarios/index.ts +++ b/src/testing/internal/scenarios/index.ts @@ -65,6 +65,7 @@ export function setupVariablesCase() { } export type MaskedVariablesCaseFragment = { + __typename: "Character"; name: string; } & { " $fragmentName"?: "MaskedVariablesCaseFragment" };