Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildClientSchema: add test for missing standard scalar #2006

Merged
merged 1 commit into from Jun 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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