Skip to content

Commit 72bd71e

Browse files
buildClientSchema: add test for missing standard scalar (#2006)
Context: #2005
1 parent 3c54315 commit 72bd71e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/utilities/__tests__/buildClientSchema-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,24 @@ describe('Type System: build schema from introspection', () => {
581581
);
582582
});
583583

584+
it('throws when missing definition for one of the standard scalars', () => {
585+
const schema = buildSchema(`
586+
type Query {
587+
foo: Float
588+
}
589+
`);
590+
const introspection = introspectionFromSchema(schema);
591+
592+
// $DisableFlowOnNegativeTest
593+
introspection.__schema.types = introspection.__schema.types.filter(
594+
({ name }) => name !== 'Float',
595+
);
596+
597+
expect(() => buildClientSchema(introspection)).to.throw(
598+
'Invalid or incomplete schema, unknown type: Float. Ensure that a full introspection query is used in order to build a client schema.',
599+
);
600+
});
601+
584602
it('throws when type reference is missing name', () => {
585603
const introspection = introspectionFromSchema(dummySchema);
586604

0 commit comments

Comments
 (0)