Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit e51d989

Browse files
committed
Update snapshot
1 parent 660d307 commit e51d989

File tree

1 file changed

+342
-0
lines changed

1 file changed

+342
-0
lines changed

test/__snapshots__/TypeScriptGenerator-test.ts.snap

Lines changed: 342 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ fragment UserFrag1 on User {
9090
fragment UserFrag2 on User {
9191
__typename
9292
}
93+
9394
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
9495
// FragmentSpread.graphql
9596
import { FragmentRefs } from "relay-runtime";
@@ -613,6 +614,176 @@ export type MarkdownUserNameRenderer_name$key = {
613614
614615
`;
615616

617+
exports[`Snapshot tests TypeScriptGenerator with a single artifact directory matches expected output: mutaion-with-client-extension.graphql 1`] = `
618+
~~~~~~~~~~ INPUT ~~~~~~~~~~
619+
mutation Test($input: UpdateAllSeenStateInput) @raw_response_type {
620+
viewerNotificationsUpdateAllSeenState(input: $input) {
621+
stories {
622+
foos {
623+
bar
624+
}
625+
}
626+
}
627+
}
628+
629+
extend type Story {
630+
foos: [Foo]
631+
}
632+
633+
type Foo {
634+
bar: String
635+
}
636+
637+
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
638+
// Test.graphql
639+
export type UpdateAllSeenStateInput = {
640+
clientMutationId?: string | null;
641+
storyIds?: Array<string | null> | null;
642+
};
643+
export type TestVariables = {
644+
input?: UpdateAllSeenStateInput | null;
645+
};
646+
export type TestResponse = {
647+
readonly viewerNotificationsUpdateAllSeenState: {
648+
readonly stories: ReadonlyArray<{
649+
readonly foos: ReadonlyArray<{
650+
readonly bar: string | null;
651+
} | null> | null;
652+
} | null> | null;
653+
} | null;
654+
};
655+
export type TestRawResponse = {
656+
readonly viewerNotificationsUpdateAllSeenState: ({
657+
readonly stories: ReadonlyArray<({
658+
readonly id: string;
659+
readonly foos?: ReadonlyArray<({
660+
readonly bar: string | null;
661+
}) | null> | null;
662+
}) | null> | null;
663+
}) | null;
664+
};
665+
export type Test = {
666+
readonly response: TestResponse;
667+
readonly variables: TestVariables;
668+
readonly rawResponse: TestRawResponse;
669+
};
670+
671+
`;
672+
673+
exports[`Snapshot tests TypeScriptGenerator with a single artifact directory matches expected output: mutaion-with-response-on-inline-fragments.graphql 1`] = `
674+
~~~~~~~~~~ INPUT ~~~~~~~~~~
675+
mutation TestMutation($input: CommentCreateInput!) @raw_response_type {
676+
commentCreate(input: $input) {
677+
viewer {
678+
actor {
679+
...InlineFragmentWithOverlappingFields
680+
}
681+
}
682+
}
683+
}
684+
685+
fragment InlineFragmentWithOverlappingFields on Actor {
686+
... on User {
687+
hometown {
688+
id
689+
name
690+
}
691+
}
692+
... on Page {
693+
name
694+
hometown {
695+
id
696+
message {
697+
text
698+
}
699+
}
700+
}
701+
}
702+
703+
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
704+
// TestMutation.graphql
705+
import { FragmentRefs } from "relay-runtime";
706+
export type CommentCreateInput = {
707+
clientMutationId?: string | null;
708+
feedbackId?: string | null;
709+
feedback?: CommentfeedbackFeedback | null;
710+
};
711+
export type CommentfeedbackFeedback = {
712+
comment?: FeedbackcommentComment | null;
713+
};
714+
export type FeedbackcommentComment = {
715+
feedback?: CommentfeedbackFeedback | null;
716+
};
717+
export type TestMutationVariables = {
718+
input: CommentCreateInput;
719+
};
720+
export type TestMutationResponse = {
721+
readonly commentCreate: {
722+
readonly viewer: {
723+
readonly actor: {
724+
readonly " $fragmentRefs": FragmentRefs<"InlineFragmentWithOverlappingFields">;
725+
} | null;
726+
} | null;
727+
} | null;
728+
};
729+
export type TestMutationRawResponse = {
730+
readonly commentCreate: ({
731+
readonly viewer: ({
732+
readonly actor: ({
733+
readonly __typename: "User";
734+
readonly __isActor: "User";
735+
readonly id: string;
736+
readonly hometown: ({
737+
readonly id: string;
738+
readonly name: string | null;
739+
}) | null;
740+
} | {
741+
readonly __typename: "Page";
742+
readonly __isActor: "Page";
743+
readonly id: string;
744+
readonly name: string | null;
745+
readonly hometown: ({
746+
readonly id: string;
747+
readonly message: ({
748+
readonly text: string | null;
749+
}) | null;
750+
}) | null;
751+
} | {
752+
readonly __typename: string;
753+
readonly __isActor: string;
754+
readonly id: string;
755+
}) | null;
756+
}) | null;
757+
}) | null;
758+
};
759+
export type TestMutation = {
760+
readonly response: TestMutationResponse;
761+
readonly variables: TestMutationVariables;
762+
readonly rawResponse: TestMutationRawResponse;
763+
};
764+
765+
766+
// InlineFragmentWithOverlappingFields.graphql
767+
import { FragmentRefs } from "relay-runtime";
768+
export type InlineFragmentWithOverlappingFields = {
769+
readonly hometown?: {
770+
readonly id: string;
771+
readonly name: string | null;
772+
readonly message?: {
773+
readonly text: string | null;
774+
} | null;
775+
} | null;
776+
readonly name?: string | null;
777+
readonly " $refType": "InlineFragmentWithOverlappingFields";
778+
};
779+
export type InlineFragmentWithOverlappingFields$data = InlineFragmentWithOverlappingFields;
780+
export type InlineFragmentWithOverlappingFields$key = {
781+
readonly " $data"?: InlineFragmentWithOverlappingFields$data;
782+
readonly " $fragmentRefs": FragmentRefs<"InlineFragmentWithOverlappingFields">;
783+
};
784+
785+
`;
786+
616787
exports[`Snapshot tests TypeScriptGenerator with a single artifact directory matches expected output: mutation.graphql 1`] = `
617788
~~~~~~~~~~ INPUT ~~~~~~~~~~
618789
mutation CommentCreateMutation(
@@ -2453,6 +2624,7 @@ fragment UserFrag1 on User {
24532624
fragment UserFrag2 on User {
24542625
__typename
24552626
}
2627+
24562628
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
24572629
// FragmentSpread.graphql
24582630
import { FragmentRefs } from "relay-runtime";
@@ -2976,6 +3148,176 @@ export type MarkdownUserNameRenderer_name$key = {
29763148
29773149
`;
29783150
3151+
exports[`Snapshot tests TypeScriptGenerator without a single artifact directory matches expected output: mutaion-with-client-extension.graphql 1`] = `
3152+
~~~~~~~~~~ INPUT ~~~~~~~~~~
3153+
mutation Test($input: UpdateAllSeenStateInput) @raw_response_type {
3154+
viewerNotificationsUpdateAllSeenState(input: $input) {
3155+
stories {
3156+
foos {
3157+
bar
3158+
}
3159+
}
3160+
}
3161+
}
3162+
3163+
extend type Story {
3164+
foos: [Foo]
3165+
}
3166+
3167+
type Foo {
3168+
bar: String
3169+
}
3170+
3171+
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
3172+
// Test.graphql
3173+
export type UpdateAllSeenStateInput = {
3174+
clientMutationId?: string | null;
3175+
storyIds?: Array<string | null> | null;
3176+
};
3177+
export type TestVariables = {
3178+
input?: UpdateAllSeenStateInput | null;
3179+
};
3180+
export type TestResponse = {
3181+
readonly viewerNotificationsUpdateAllSeenState: {
3182+
readonly stories: ReadonlyArray<{
3183+
readonly foos: ReadonlyArray<{
3184+
readonly bar: string | null;
3185+
} | null> | null;
3186+
} | null> | null;
3187+
} | null;
3188+
};
3189+
export type TestRawResponse = {
3190+
readonly viewerNotificationsUpdateAllSeenState: ({
3191+
readonly stories: ReadonlyArray<({
3192+
readonly id: string;
3193+
readonly foos?: ReadonlyArray<({
3194+
readonly bar: string | null;
3195+
}) | null> | null;
3196+
}) | null> | null;
3197+
}) | null;
3198+
};
3199+
export type Test = {
3200+
readonly response: TestResponse;
3201+
readonly variables: TestVariables;
3202+
readonly rawResponse: TestRawResponse;
3203+
};
3204+
3205+
`;
3206+
3207+
exports[`Snapshot tests TypeScriptGenerator without a single artifact directory matches expected output: mutaion-with-response-on-inline-fragments.graphql 1`] = `
3208+
~~~~~~~~~~ INPUT ~~~~~~~~~~
3209+
mutation TestMutation($input: CommentCreateInput!) @raw_response_type {
3210+
commentCreate(input: $input) {
3211+
viewer {
3212+
actor {
3213+
...InlineFragmentWithOverlappingFields
3214+
}
3215+
}
3216+
}
3217+
}
3218+
3219+
fragment InlineFragmentWithOverlappingFields on Actor {
3220+
... on User {
3221+
hometown {
3222+
id
3223+
name
3224+
}
3225+
}
3226+
... on Page {
3227+
name
3228+
hometown {
3229+
id
3230+
message {
3231+
text
3232+
}
3233+
}
3234+
}
3235+
}
3236+
3237+
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
3238+
// TestMutation.graphql
3239+
import { FragmentRefs } from "relay-runtime";
3240+
export type CommentCreateInput = {
3241+
clientMutationId?: string | null;
3242+
feedbackId?: string | null;
3243+
feedback?: CommentfeedbackFeedback | null;
3244+
};
3245+
export type CommentfeedbackFeedback = {
3246+
comment?: FeedbackcommentComment | null;
3247+
};
3248+
export type FeedbackcommentComment = {
3249+
feedback?: CommentfeedbackFeedback | null;
3250+
};
3251+
export type TestMutationVariables = {
3252+
input: CommentCreateInput;
3253+
};
3254+
export type TestMutationResponse = {
3255+
readonly commentCreate: {
3256+
readonly viewer: {
3257+
readonly actor: {
3258+
readonly " $fragmentRefs": FragmentRefs<"InlineFragmentWithOverlappingFields">;
3259+
} | null;
3260+
} | null;
3261+
} | null;
3262+
};
3263+
export type TestMutationRawResponse = {
3264+
readonly commentCreate: ({
3265+
readonly viewer: ({
3266+
readonly actor: ({
3267+
readonly __typename: "User";
3268+
readonly __isActor: "User";
3269+
readonly id: string;
3270+
readonly hometown: ({
3271+
readonly id: string;
3272+
readonly name: string | null;
3273+
}) | null;
3274+
} | {
3275+
readonly __typename: "Page";
3276+
readonly __isActor: "Page";
3277+
readonly id: string;
3278+
readonly name: string | null;
3279+
readonly hometown: ({
3280+
readonly id: string;
3281+
readonly message: ({
3282+
readonly text: string | null;
3283+
}) | null;
3284+
}) | null;
3285+
} | {
3286+
readonly __typename: string;
3287+
readonly __isActor: string;
3288+
readonly id: string;
3289+
}) | null;
3290+
}) | null;
3291+
}) | null;
3292+
};
3293+
export type TestMutation = {
3294+
readonly response: TestMutationResponse;
3295+
readonly variables: TestMutationVariables;
3296+
readonly rawResponse: TestMutationRawResponse;
3297+
};
3298+
3299+
3300+
// InlineFragmentWithOverlappingFields.graphql
3301+
import { FragmentRefs } from "relay-runtime";
3302+
export type InlineFragmentWithOverlappingFields = {
3303+
readonly hometown?: {
3304+
readonly id: string;
3305+
readonly name: string | null;
3306+
readonly message?: {
3307+
readonly text: string | null;
3308+
} | null;
3309+
} | null;
3310+
readonly name?: string | null;
3311+
readonly " $refType": "InlineFragmentWithOverlappingFields";
3312+
};
3313+
export type InlineFragmentWithOverlappingFields$data = InlineFragmentWithOverlappingFields;
3314+
export type InlineFragmentWithOverlappingFields$key = {
3315+
readonly " $data"?: InlineFragmentWithOverlappingFields$data;
3316+
readonly " $fragmentRefs": FragmentRefs<"InlineFragmentWithOverlappingFields">;
3317+
};
3318+
3319+
`;
3320+
29793321
exports[`Snapshot tests TypeScriptGenerator without a single artifact directory matches expected output: mutation.graphql 1`] = `
29803322
~~~~~~~~~~ INPUT ~~~~~~~~~~
29813323
mutation CommentCreateMutation(

0 commit comments

Comments
 (0)