Skip to content

Error handling #1

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

Merged
merged 12 commits into from
Jun 5, 2025
28 changes: 16 additions & 12 deletions src/utilities/__tests__/resolveSchemaCoordinate-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ describe('resolveSchemaCoordinate', () => {
undefined,
);

expect(resolveSchemaCoordinate(schema, 'Unknown.field')).to.deep.equal(
undefined,
expect(() => resolveSchemaCoordinate(schema, 'Unknown.field')).to.throw(
'Expected "Unknown" to be defined as a type in the schema.',
);

expect(resolveSchemaCoordinate(schema, 'String.field')).to.deep.equal(
undefined,
expect(() => resolveSchemaCoordinate(schema, 'String.field')).to.throw(
'Expected "String" to be an object type, interface type, input object type, or enum type.',
);
});

Expand Down Expand Up @@ -130,17 +130,21 @@ describe('resolveSchemaCoordinate', () => {
resolveSchemaCoordinate(schema, 'Business.name(unknown:)'),
).to.deep.equal(undefined);

expect(
expect(() =>
resolveSchemaCoordinate(schema, 'Unknown.field(arg:)'),
).to.deep.equal(undefined);
).to.throw('Expected "Unknown" to be defined as a type in the schema.');

expect(
expect(() =>
resolveSchemaCoordinate(schema, 'Business.unknown(arg:)'),
).to.deep.equal(undefined);
).to.throw(
'Expected "unknown" to exist as a field of type "Business" in the schema.',
);

expect(
expect(() =>
resolveSchemaCoordinate(schema, 'SearchCriteria.name(arg:)'),
).to.deep.equal(undefined);
).to.throw(
'Expected "SearchCriteria" to be an object type or interface type.',
);
});

it('resolves a Directive', () => {
Expand Down Expand Up @@ -178,8 +182,8 @@ describe('resolveSchemaCoordinate', () => {
undefined,
);

expect(resolveSchemaCoordinate(schema, '@unknown(arg:)')).to.deep.equal(
undefined,
expect(() => resolveSchemaCoordinate(schema, '@unknown(arg:)')).to.throw(
'Expected "unknown" to be defined as a directive in the schema.',
);
});
});
Loading
Loading