Skip to content

Commit 6465161

Browse files
mohawk2leebyron
authored andcommitted
make buildObjectDef more robust (#1053)
* test handle introspected schema with invalidly null interfaces * Reformat test to more clearly indicate "missing"
1 parent c1b6b32 commit 6465161

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/utilities/__tests__/buildClientSchema-test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,37 @@ describe('Type System: build schema from introspection', () => {
762762
);
763763
});
764764

765+
it('throws when missing interfaces', () => {
766+
const nullInterfaceIntrospection = {
767+
__schema: {
768+
queryType: { name: 'QueryType' },
769+
types: [
770+
{
771+
kind: 'OBJECT',
772+
name: 'QueryType',
773+
fields: [
774+
{
775+
name: 'aString',
776+
args: [],
777+
type: { kind: 'SCALAR', name: 'String', ofType: null },
778+
isDeprecated: false,
779+
}
780+
],
781+
}
782+
]
783+
}
784+
};
785+
786+
expect(
787+
() => buildClientSchema(nullInterfaceIntrospection)
788+
).to.throw(
789+
'Introspection result missing interfaces: {"kind":"OBJECT",' +
790+
'"name":"QueryType","fields":[{"name":"aString","args":[],' +
791+
'"type":{"kind":"SCALAR","name":"String","ofType":null},' +
792+
'"isDeprecated":false}]}'
793+
);
794+
});
795+
765796
});
766797

767798
describe('very deep decorators are not supported', () => {

0 commit comments

Comments
 (0)