Skip to content

Commit

Permalink
Ensure tests include __typename in types
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Nov 25, 2024
1 parent ad9710b commit 5fe3bcc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/react/hooks/__tests__/useBackgroundQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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" };

Expand Down
2 changes: 2 additions & 0 deletions src/react/hooks/__tests__/useLazyQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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" };

Expand Down Expand Up @@ -2600,6 +2601,7 @@ describe.skip("Type Tests", () => {

test("uses unmasked types when using TypedDocumentNode", async () => {
type UserFieldsFragment = {
__typename: "User";
age: number;
} & { " $fragmentName"?: "UserFieldsFragment" };

Expand Down
1 change: 1 addition & 0 deletions src/react/hooks/__tests__/useMutation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3242,6 +3242,7 @@ describe.skip("Type Tests", () => {

test("uses masked/unmasked type when using Masked<TData>", async () => {
type UserFieldsFragment = {
__typename: "User";
age: number;
} & { " $fragmentName": "UserFieldsFragment" };

Expand Down
1 change: 1 addition & 0 deletions src/react/hooks/__tests__/useQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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" };

Expand Down
1 change: 1 addition & 0 deletions src/react/hooks/__tests__/useSubscription.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2419,6 +2419,7 @@ describe.skip("Type Tests", () => {

test("uses unmasked types when using TypedDocumentNode", async () => {
type UserFieldsFragment = {
__typename: "User";
age: number;
} & { " $fragmentName"?: "UserFieldsFragment" };

Expand Down
4 changes: 4 additions & 0 deletions src/react/hooks/__tests__/useSuspenseQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -11461,6 +11464,7 @@ describe("useSuspenseQuery", () => {

it("masks partial cache data when returnPartialData is `true`", async () => {
type UserFieldsFragment = {
__typename: "User";
age: number;
} & { " $fragmentName"?: "UserFieldsFragment" };

Expand Down
1 change: 1 addition & 0 deletions src/testing/internal/scenarios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function setupVariablesCase() {
}

export type MaskedVariablesCaseFragment = {
__typename: "Character";
name: string;
} & { " $fragmentName"?: "MaskedVariablesCaseFragment" };

Expand Down

0 comments on commit 5fe3bcc

Please sign in to comment.