Skip to content

Commit 877be3c

Browse files
lilianammmatosrobrichard
authored andcommitted
add defer enabled schema, add secretFriend field
1 parent 87a0974 commit 877be3c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/__tests__/starWarsSchema.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,19 @@ const humanType = new GraphQLObjectType({
177177
type: GraphQLString,
178178
description: 'The home planet of the human, or null if unknown.',
179179
},
180+
secretFriend: {
181+
type: GraphQLString,
182+
description: 'A friend of the human whose identity should remain hidden.',
183+
resolve() {
184+
return new Promise(resolve => {
185+
setTimeout(() => {
186+
resolve();
187+
}, 10);
188+
}).then(() => {
189+
throw new Error('secretFriend is secret.');
190+
});
191+
},
192+
},
180193
secretBackstory: {
181194
type: GraphQLString,
182195
description: 'Where are they from and how they came to be who they are.',
@@ -297,3 +310,9 @@ export const StarWarsSchema: GraphQLSchema = new GraphQLSchema({
297310
query: queryType,
298311
types: [humanType, droidType],
299312
});
313+
314+
export const StarWarsSchemaDeferEnabled = new GraphQLSchema({
315+
query: queryType,
316+
types: [humanType, droidType],
317+
experimentalDeferFragmentSpreads: true,
318+
});

0 commit comments

Comments
 (0)