From d04c7bef8eb637b0f8d1555f957706890c9ffe9c Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Tue, 23 May 2023 16:40:54 -0700 Subject: [PATCH] MockPayloadGenerator support for @no_inline with args Summary: MockPayloadGenerator had partial support for `no_inline` (which appears as FragmentSpread nodes in normalization ASTs). However, we missed adding support for `arguments` to `no_inline` fragments, this diff adds support. Reviewed By: captbaritone Differential Revision: D46122331 fbshipit-source-id: 24b5e8c2e86184a0bf63f60400a62a35104a8c42 --- packages/relay-runtime/index.js | 1 + .../RelayMockPayloadGenerator.js | 20 ++- .../RelayMockPayloadGenerator-test.js | 52 ++++++- ...MockPayloadGeneratorTest58Query.graphql.js | 137 ++++++++++++++++ ...MockPayloadGeneratorTest60Query.graphql.js | 146 ++++++++++++++++++ ...orTest_fragment59$normalization.graphql.js | 69 +++++++++ ...PayloadGeneratorTest_fragment59.graphql.js | 80 ++++++++++ ...orTest_fragment61$normalization.graphql.js | 69 +++++++++ ...PayloadGeneratorTest_fragment61.graphql.js | 80 ++++++++++ .../RelayMockPayloadGenerator-test.js.snap | 56 +++++++ 10 files changed, 708 insertions(+), 2 deletions(-) create mode 100644 packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest58Query.graphql.js create mode 100644 packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest60Query.graphql.js create mode 100644 packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59$normalization.graphql.js create mode 100644 packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59.graphql.js create mode 100644 packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61$normalization.graphql.js create mode 100644 packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61.graphql.js diff --git a/packages/relay-runtime/index.js b/packages/relay-runtime/index.js index 6124b80665431..4638742a4eb29 100644 --- a/packages/relay-runtime/index.js +++ b/packages/relay-runtime/index.js @@ -356,6 +356,7 @@ module.exports = { OperationTracker: RelayOperationTracker, createRelayContext: createRelayContext, getOperationVariables: RelayConcreteVariables.getOperationVariables, + getLocalVariables: RelayConcreteVariables.getLocalVariables, fetchQuery: fetchQueryInternal.fetchQuery, fetchQueryDeduped: fetchQueryInternal.fetchQueryDeduped, getPromiseForActiveRequest: fetchQueryInternal.getPromiseForActiveRequest, diff --git a/packages/relay-test-utils/RelayMockPayloadGenerator.js b/packages/relay-test-utils/RelayMockPayloadGenerator.js index a5f0a7e58be5f..cf60c2f73f902 100644 --- a/packages/relay-test-utils/RelayMockPayloadGenerator.js +++ b/packages/relay-test-utils/RelayMockPayloadGenerator.js @@ -26,6 +26,7 @@ import type { const invariant = require('invariant'); const { + __internal, RelayConcreteNode, TYPENAME_KEY, getModuleComponentKey, @@ -314,8 +315,24 @@ class RelayMockPayloadGenerator { break; } - case CLIENT_COMPONENT: + case CLIENT_COMPONENT: { + mockData = this._traverseSelections( + selection.fragment.selections, + typeName, + isAbstractType, + path, + mockData, + defaultValues, + ); + break; + } case FRAGMENT_SPREAD: { + const prevVariables = this._variables; + this._variables = __internal.getLocalVariables( + this._variables, + selection.fragment.argumentDefinitions, + selection.args, + ); mockData = this._traverseSelections( selection.fragment.selections, typeName, @@ -324,6 +341,7 @@ class RelayMockPayloadGenerator { mockData, defaultValues, ); + this._variables = prevVariables; break; } diff --git a/packages/relay-test-utils/__tests__/RelayMockPayloadGenerator-test.js b/packages/relay-test-utils/__tests__/RelayMockPayloadGenerator-test.js index 51f976ab55c8c..cbaf9bfba3021 100644 --- a/packages/relay-test-utils/__tests__/RelayMockPayloadGenerator-test.js +++ b/packages/relay-test-utils/__tests__/RelayMockPayloadGenerator-test.js @@ -22,8 +22,9 @@ function testGeneratedData( query: Query, mockResolvers: ?MockResolvers, options: ?{mockClientData?: boolean}, + variables: Variables = {}, ): void { - const operation = createOperationDescriptor(query, {}); + const operation = createOperationDescriptor(query, variables); const payload = RelayMockPayloadGenerator.generate( operation, mockResolvers, @@ -1689,3 +1690,52 @@ describe('with @relay_test_operation', () => { }); }); }); + +test('Query with @no_inline fragment spread with literal argument', () => { + const query = graphql` + query RelayMockPayloadGeneratorTest58Query { + node(id: "4") { + ...RelayMockPayloadGeneratorTest_fragment59 @arguments(cond: true) + } + } + `; + graphql` + fragment RelayMockPayloadGeneratorTest_fragment59 on User + @argumentDefinitions(cond: {type: "Boolean", defaultValue: false}) + @no_inline(raw_response_type: true) { + id + name @include(if: $cond) + } + `; + testGeneratedData(query, undefined, { + mockClientData: false, + }); +}); + +test('Query with @no_inline fragment spread with variable argument', () => { + const query = graphql` + query RelayMockPayloadGeneratorTest60Query($cond: Boolean!) { + node(id: "4") { + ...RelayMockPayloadGeneratorTest_fragment61 @arguments(cond: $cond) + } + } + `; + graphql` + fragment RelayMockPayloadGeneratorTest_fragment61 on User + @argumentDefinitions(cond: {type: "Boolean", defaultValue: false}) + @no_inline(raw_response_type: true) { + id + name @include(if: $cond) + } + `; + testGeneratedData( + query, + undefined, + { + mockClientData: false, + }, + { + cond: true, + }, + ); +}); diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest58Query.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest58Query.graphql.js new file mode 100644 index 0000000000000..e6dcfce994bd7 --- /dev/null +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest58Query.graphql.js @@ -0,0 +1,137 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<<5be38ced0f7b5fc865350942614026f0>> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest, Query } from 'relay-runtime'; +import type { RelayMockPayloadGeneratorTest_fragment59$fragmentType } from "./RelayMockPayloadGeneratorTest_fragment59.graphql"; +export type RelayMockPayloadGeneratorTest58Query$variables = {||}; +export type RelayMockPayloadGeneratorTest58Query$data = {| + +node: ?{| + +$fragmentSpreads: RelayMockPayloadGeneratorTest_fragment59$fragmentType, + |}, +|}; +export type RelayMockPayloadGeneratorTest58Query = {| + response: RelayMockPayloadGeneratorTest58Query$data, + variables: RelayMockPayloadGeneratorTest58Query$variables, +|}; +*/ + +var node/*: ConcreteRequest*/ = (function(){ +var v0 = [ + { + "kind": "Literal", + "name": "id", + "value": "4" + } +]; +return { + "fragment": { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": null, + "name": "RelayMockPayloadGeneratorTest58Query", + "selections": [ + { + "alias": null, + "args": (v0/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": [ + { + "kind": "Literal", + "name": "cond", + "value": true + } + ], + "kind": "FragmentSpread", + "name": "RelayMockPayloadGeneratorTest_fragment59" + } + ], + "storageKey": "node(id:\"4\")" + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [], + "kind": "Operation", + "name": "RelayMockPayloadGeneratorTest58Query", + "selections": [ + { + "alias": null, + "args": (v0/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + }, + { + "args": [ + { + "kind": "Literal", + "name": "RelayMockPayloadGeneratorTest_fragment59$cond", + "value": true + } + ], + "fragment": require('./RelayMockPayloadGeneratorTest_fragment59$normalization.graphql'), + "kind": "FragmentSpread" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + } + ], + "storageKey": "node(id:\"4\")" + } + ] + }, + "params": { + "cacheID": "5a6272973d0967c473047a457505a252", + "id": null, + "metadata": {}, + "name": "RelayMockPayloadGeneratorTest58Query", + "operationKind": "query", + "text": "query RelayMockPayloadGeneratorTest58Query {\n node(id: \"4\") {\n __typename\n ...RelayMockPayloadGeneratorTest_fragment59_22eGLd\n id\n }\n}\n\nfragment RelayMockPayloadGeneratorTest_fragment59_22eGLd on User {\n id\n name\n}\n" + } +}; +})(); + +if (__DEV__) { + (node/*: any*/).hash = "7207fa27437b4334d2950de9e7043322"; +} + +module.exports = ((node/*: any*/)/*: Query< + RelayMockPayloadGeneratorTest58Query$variables, + RelayMockPayloadGeneratorTest58Query$data, +>*/); diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest60Query.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest60Query.graphql.js new file mode 100644 index 0000000000000..cf94aeca80f08 --- /dev/null +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest60Query.graphql.js @@ -0,0 +1,146 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest, Query } from 'relay-runtime'; +import type { RelayMockPayloadGeneratorTest_fragment61$fragmentType } from "./RelayMockPayloadGeneratorTest_fragment61.graphql"; +export type RelayMockPayloadGeneratorTest60Query$variables = {| + cond: boolean, +|}; +export type RelayMockPayloadGeneratorTest60Query$data = {| + +node: ?{| + +$fragmentSpreads: RelayMockPayloadGeneratorTest_fragment61$fragmentType, + |}, +|}; +export type RelayMockPayloadGeneratorTest60Query = {| + response: RelayMockPayloadGeneratorTest60Query$data, + variables: RelayMockPayloadGeneratorTest60Query$variables, +|}; +*/ + +var node/*: ConcreteRequest*/ = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "cond" + } +], +v1 = [ + { + "kind": "Literal", + "name": "id", + "value": "4" + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "RelayMockPayloadGeneratorTest60Query", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": [ + { + "kind": "Variable", + "name": "cond", + "variableName": "cond" + } + ], + "kind": "FragmentSpread", + "name": "RelayMockPayloadGeneratorTest_fragment61" + } + ], + "storageKey": "node(id:\"4\")" + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "RelayMockPayloadGeneratorTest60Query", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + }, + { + "args": [ + { + "kind": "Variable", + "name": "RelayMockPayloadGeneratorTest_fragment61$cond", + "variableName": "cond" + } + ], + "fragment": require('./RelayMockPayloadGeneratorTest_fragment61$normalization.graphql'), + "kind": "FragmentSpread" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + } + ], + "storageKey": "node(id:\"4\")" + } + ] + }, + "params": { + "cacheID": "fea43ee9ba842a5f60a79b84f0bcb503", + "id": null, + "metadata": {}, + "name": "RelayMockPayloadGeneratorTest60Query", + "operationKind": "query", + "text": "query RelayMockPayloadGeneratorTest60Query(\n $cond: Boolean!\n) {\n node(id: \"4\") {\n __typename\n ...RelayMockPayloadGeneratorTest_fragment61_yuQoQ\n id\n }\n}\n\nfragment RelayMockPayloadGeneratorTest_fragment61_yuQoQ on User {\n id\n name @include(if: $cond)\n}\n" + } +}; +})(); + +if (__DEV__) { + (node/*: any*/).hash = "3deee5972aa6d5f988a035cc01194d24"; +} + +module.exports = ((node/*: any*/)/*: Query< + RelayMockPayloadGeneratorTest60Query$variables, + RelayMockPayloadGeneratorTest60Query$data, +>*/); diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59$normalization.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59$normalization.graphql.js new file mode 100644 index 0000000000000..c7b2a6453db73 --- /dev/null +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59$normalization.graphql.js @@ -0,0 +1,69 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { NormalizationSplitOperation } from 'relay-runtime'; + +export type RelayMockPayloadGeneratorTest_fragment59$normalization = {| + +id: string, + +name: ?string, +|}; + +*/ + +var node/*: NormalizationSplitOperation*/ = { + "argumentDefinitions": [ + { + "defaultValue": false, + "kind": "LocalArgument", + "name": "RelayMockPayloadGeneratorTest_fragment59$cond" + } + ], + "kind": "SplitOperation", + "metadata": {}, + "name": "RelayMockPayloadGeneratorTest_fragment59$normalization", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "condition": "RelayMockPayloadGeneratorTest_fragment59$cond", + "kind": "Condition", + "passingValue": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ] + } + ] +}; + +if (__DEV__) { + (node/*: any*/).hash = "efeafd8b46bc5e1d5e9deb6e69637ccc"; +} + +module.exports = node; diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59.graphql.js new file mode 100644 index 0000000000000..ee19a8722579f --- /dev/null +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment59.graphql.js @@ -0,0 +1,80 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<<05d635030c8cf95ac5f389fc1fa09a0c>> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { Fragment, ReaderFragment } from 'relay-runtime'; +import type { FragmentType } from "relay-runtime"; +declare export opaque type RelayMockPayloadGeneratorTest_fragment59$fragmentType: FragmentType; +export type RelayMockPayloadGeneratorTest_fragment59$data = {| + +id: string, + +name?: ?string, + +$fragmentType: RelayMockPayloadGeneratorTest_fragment59$fragmentType, +|}; +export type RelayMockPayloadGeneratorTest_fragment59$key = { + +$data?: RelayMockPayloadGeneratorTest_fragment59$data, + +$fragmentSpreads: RelayMockPayloadGeneratorTest_fragment59$fragmentType, + ... +}; +*/ + +var node/*: ReaderFragment*/ = { + "argumentDefinitions": [ + { + "defaultValue": false, + "kind": "LocalArgument", + "name": "cond" + } + ], + "kind": "Fragment", + "metadata": null, + "name": "RelayMockPayloadGeneratorTest_fragment59", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "condition": "cond", + "kind": "Condition", + "passingValue": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ] + } + ], + "type": "User", + "abstractKey": null +}; + +if (__DEV__) { + (node/*: any*/).hash = "efeafd8b46bc5e1d5e9deb6e69637ccc"; +} + +module.exports = ((node/*: any*/)/*: Fragment< + RelayMockPayloadGeneratorTest_fragment59$fragmentType, + RelayMockPayloadGeneratorTest_fragment59$data, +>*/); diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61$normalization.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61$normalization.graphql.js new file mode 100644 index 0000000000000..f74056539c116 --- /dev/null +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61$normalization.graphql.js @@ -0,0 +1,69 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { NormalizationSplitOperation } from 'relay-runtime'; + +export type RelayMockPayloadGeneratorTest_fragment61$normalization = {| + +id: string, + +name: ?string, +|}; + +*/ + +var node/*: NormalizationSplitOperation*/ = { + "argumentDefinitions": [ + { + "defaultValue": false, + "kind": "LocalArgument", + "name": "RelayMockPayloadGeneratorTest_fragment61$cond" + } + ], + "kind": "SplitOperation", + "metadata": {}, + "name": "RelayMockPayloadGeneratorTest_fragment61$normalization", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "condition": "RelayMockPayloadGeneratorTest_fragment61$cond", + "kind": "Condition", + "passingValue": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ] + } + ] +}; + +if (__DEV__) { + (node/*: any*/).hash = "25e64d959ac400af76cce1c64d022f38"; +} + +module.exports = node; diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61.graphql.js new file mode 100644 index 0000000000000..5d4ac3e872253 --- /dev/null +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest_fragment61.graphql.js @@ -0,0 +1,80 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<<699a048863dd7792d83ed44763f446ed>> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { Fragment, ReaderFragment } from 'relay-runtime'; +import type { FragmentType } from "relay-runtime"; +declare export opaque type RelayMockPayloadGeneratorTest_fragment61$fragmentType: FragmentType; +export type RelayMockPayloadGeneratorTest_fragment61$data = {| + +id: string, + +name?: ?string, + +$fragmentType: RelayMockPayloadGeneratorTest_fragment61$fragmentType, +|}; +export type RelayMockPayloadGeneratorTest_fragment61$key = { + +$data?: RelayMockPayloadGeneratorTest_fragment61$data, + +$fragmentSpreads: RelayMockPayloadGeneratorTest_fragment61$fragmentType, + ... +}; +*/ + +var node/*: ReaderFragment*/ = { + "argumentDefinitions": [ + { + "defaultValue": false, + "kind": "LocalArgument", + "name": "cond" + } + ], + "kind": "Fragment", + "metadata": null, + "name": "RelayMockPayloadGeneratorTest_fragment61", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "condition": "cond", + "kind": "Condition", + "passingValue": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ] + } + ], + "type": "User", + "abstractKey": null +}; + +if (__DEV__) { + (node/*: any*/).hash = "25e64d959ac400af76cce1c64d022f38"; +} + +module.exports = ((node/*: any*/)/*: Fragment< + RelayMockPayloadGeneratorTest_fragment61$fragmentType, + RelayMockPayloadGeneratorTest_fragment61$data, +>*/); diff --git a/packages/relay-test-utils/__tests__/__snapshots__/RelayMockPayloadGenerator-test.js.snap b/packages/relay-test-utils/__tests__/__snapshots__/RelayMockPayloadGenerator-test.js.snap index e54e8f1907eb5..f6910b0dbcd0c 100644 --- a/packages/relay-test-utils/__tests__/__snapshots__/RelayMockPayloadGenerator-test.js.snap +++ b/packages/relay-test-utils/__tests__/__snapshots__/RelayMockPayloadGenerator-test.js.snap @@ -1,5 +1,61 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Query with @no_inline fragment spread with literal argument 1`] = ` +~~~~~~~~~~ INPUT ~~~~~~~~~~ +query RelayMockPayloadGeneratorTest58Query { + node(id: "4") { + __typename + ...RelayMockPayloadGeneratorTest_fragment59_22eGLd + id + } +} + +fragment RelayMockPayloadGeneratorTest_fragment59_22eGLd on User { + id + name +} + +~~~~~~~~~~ OUTPUT ~~~~~~~~~~ +{ + "data": { + "node": { + "__typename": "__MockObject", + "id": "", + "name": "" + } + } +} +`; + +exports[`Query with @no_inline fragment spread with variable argument 1`] = ` +~~~~~~~~~~ INPUT ~~~~~~~~~~ +query RelayMockPayloadGeneratorTest60Query( + $cond: Boolean! +) { + node(id: "4") { + __typename + ...RelayMockPayloadGeneratorTest_fragment61_yuQoQ + id + } +} + +fragment RelayMockPayloadGeneratorTest_fragment61_yuQoQ on User { + id + name @include(if: $cond) +} + +~~~~~~~~~~ OUTPUT ~~~~~~~~~~ +{ + "data": { + "node": { + "__typename": "__MockObject", + "id": "", + "name": "" + } + } +} +`; + exports[`check context in the mock resolver 1`] = ` ~~~~~~~~~~ INPUT ~~~~~~~~~~ query RelayMockPayloadGeneratorTest11Query {