File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -1189,6 +1189,46 @@ describe('Execute: Handles inputs', () => {
1189
1189
} ) ;
1190
1190
} ) ;
1191
1191
1192
+ it ( 'when a value is required and provided, and the definition spreads another fragment' , ( ) => {
1193
+ const result = executeQueryWithFragmentArguments ( `
1194
+ query {
1195
+ ...a(value: "A")
1196
+ }
1197
+ fragment a($value: String!) on TestType {
1198
+ ...b(value: $value)
1199
+ }
1200
+ fragment b($value: String!) on TestType {
1201
+ fieldWithNonNullableStringInput(input: $value)
1202
+ }
1203
+ ` ) ;
1204
+ expect ( result ) . to . deep . equal ( {
1205
+ data : {
1206
+ fieldWithNonNullableStringInput : '"A"' ,
1207
+ } ,
1208
+ } ) ;
1209
+ } ) ;
1210
+
1211
+ it ( 'when a value is required and provided, and the definition uses the variable and spreads another fragment with a different value' , ( ) => {
1212
+ const result = executeQueryWithFragmentArguments ( `
1213
+ query {
1214
+ ...a(value: "A")
1215
+ }
1216
+ fragment a($value: String!) on TestType {
1217
+ ...b(value: "B")
1218
+ fieldInFragmentA: fieldWithNonNullableStringInput(input: $value)
1219
+ }
1220
+ fragment b($value: String!) on TestType {
1221
+ fieldInFragmentB: fieldWithNonNullableStringInput(input: $value)
1222
+ }
1223
+ ` ) ;
1224
+ expect ( result ) . to . deep . equal ( {
1225
+ data : {
1226
+ fieldInFragmentA : '"A"' ,
1227
+ fieldInFragmentB : '"B"' ,
1228
+ } ,
1229
+ } ) ;
1230
+ } ) ;
1231
+
1192
1232
it ( 'when a value is required and not provided' , ( ) => {
1193
1233
const result = executeQueryWithFragmentArguments ( `
1194
1234
query {
You can’t perform that action at this time.
0 commit comments