From 4b2e20201baba8f2136cf2c1ff11aeeb7302477c Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 31 Jul 2018 16:33:17 +0300 Subject: [PATCH] Test absence of name clash beetween type names and directives Split out from #1438 --- src/utilities/__tests__/buildASTSchema-test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/utilities/__tests__/buildASTSchema-test.js b/src/utilities/__tests__/buildASTSchema-test.js index b2f0a45eb5..b65b8a4d79 100644 --- a/src/utilities/__tests__/buildASTSchema-test.js +++ b/src/utilities/__tests__/buildASTSchema-test.js @@ -969,6 +969,20 @@ describe('Failures', () => { ); }); + it('Does not consider directive names', () => { + const body = dedent` + schema { + query: Foo + } + + directive @Foo on QUERY + `; + const doc = parse(body); + expect(() => buildASTSchema(doc)).to.throw( + 'Specified query type "Foo" not found in document.', + ); + }); + it('Does not consider operation names', () => { const body = dedent` schema {