diff --git a/fixtures/collision/a.graphql b/fixtures/collision/a.graphql new file mode 100644 index 0000000..6fc6593 --- /dev/null +++ b/fixtures/collision/a.graphql @@ -0,0 +1,6 @@ +# import * from "b.graphql" + +type User { + id: ID! + name: String! +} \ No newline at end of file diff --git a/fixtures/collision/b.graphql b/fixtures/collision/b.graphql new file mode 100644 index 0000000..80384a0 --- /dev/null +++ b/fixtures/collision/b.graphql @@ -0,0 +1,5 @@ +type User { + id: ID! + name: String + intro: String +} diff --git a/src/index.test.ts b/src/index.test.ts index f477cf6..eeeb3d1 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -744,3 +744,14 @@ test('missing type on directive', t => { `Directive first: Couldn't find type first in any of the schemas.`, ) }) + +test('import with collision', t => { + // Local type gets preference over imported type + const expectedSDL = `\ +type User { + id: ID! + name: String! +} +` + t.is(importSchema('fixtures/collision/a.graphql'), expectedSDL) +})