You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('missing both resolveType and isTypeOf yields useful error',()=>{
447
+
constfooInterface=newGraphQLInterfaceType({
448
+
name: 'FooInterface',
449
+
fields: {bar: {type: GraphQLString}},
450
+
});
451
+
452
+
constfooObject=newGraphQLObjectType({
453
+
name: 'FooObject',
454
+
fields: {bar: {type: GraphQLString}},
455
+
interfaces: [fooInterface],
456
+
});
457
+
458
+
constschema=newGraphQLSchema({
459
+
query: newGraphQLObjectType({
460
+
name: 'Query',
461
+
fields: {
462
+
foo: {
463
+
type: fooInterface,
464
+
resolve: ()=>'dummy',
465
+
},
466
+
},
467
+
}),
468
+
types: [fooObject],
469
+
});
470
+
471
+
constresult=graphqlSync({ schema,source: '{ foo { bar } }'});
472
+
473
+
expect(result).to.deep.equal({
474
+
data: {foo: null},
475
+
errors: [
476
+
{
477
+
message:
478
+
'Abstract type "FooInterface" must resolve to an Object type at runtime for field "Query.foo" with value "dummy", received "undefined". Either the "FooInterface" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.',
479
+
locations: [{line: 1,column: 3}],
480
+
path: ['foo'],
481
+
},
482
+
],
483
+
});
484
+
});
485
+
446
486
it('resolveType allows resolving with type name',()=>{
0 commit comments