Skip to content

Commit 117cda7

Browse files
add defer enabled schema, add secretFriend field
1 parent 3910bdb commit 117cda7

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
@@ -172,6 +172,19 @@ const humanType = new GraphQLObjectType({
172172
type: GraphQLString,
173173
description: 'The home planet of the human, or null if unknown.',
174174
},
175+
secretFriend: {
176+
type: GraphQLString,
177+
description: 'A friend of the human whose identity should remain hidden.',
178+
resolve() {
179+
return new Promise(resolve => {
180+
setTimeout(() => {
181+
resolve();
182+
}, 10);
183+
}).then(() => {
184+
throw new Error('secretFriend is secret.');
185+
});
186+
},
187+
},
175188
secretBackstory: {
176189
type: GraphQLString,
177190
description: 'Where are they from and how they came to be who they are.',
@@ -292,3 +305,9 @@ export const StarWarsSchema = new GraphQLSchema({
292305
query: queryType,
293306
types: [humanType, droidType],
294307
});
308+
309+
export const StarWarsSchemaDeferEnabled = new GraphQLSchema({
310+
query: queryType,
311+
types: [humanType, droidType],
312+
experimentalDeferFragmentSpreads: true,
313+
});

0 commit comments

Comments
 (0)