Skip to content

Commit

Permalink
buildClientSchema: add test for missing standard scalar (#2006)
Browse files Browse the repository at this point in the history
Context: #2005
  • Loading branch information
IvanGoncharov committed Jun 29, 2019
1 parent 3c54315 commit 72bd71e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utilities/__tests__/buildClientSchema-test.js
Expand Up @@ -581,6 +581,24 @@ describe('Type System: build schema from introspection', () => {
);
});

it('throws when missing definition for one of the standard scalars', () => {
const schema = buildSchema(`
type Query {
foo: Float
}
`);
const introspection = introspectionFromSchema(schema);

// $DisableFlowOnNegativeTest
introspection.__schema.types = introspection.__schema.types.filter(
({ name }) => name !== 'Float',
);

expect(() => buildClientSchema(introspection)).to.throw(
'Invalid or incomplete schema, unknown type: Float. Ensure that a full introspection query is used in order to build a client schema.',
);
});

it('throws when type reference is missing name', () => {
const introspection = introspectionFromSchema(dummySchema);

Expand Down

0 comments on commit 72bd71e

Please sign in to comment.