Skip to content

Commit

Permalink
Merge pull request #210 from prismagraphql/test_collision
Browse files Browse the repository at this point in the history
test: add test case for collision
  • Loading branch information
Divyendu Singh authored Aug 13, 2018
2 parents 8e8b045 + 87aa832 commit 96bad6d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fixtures/collision/a.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# import * from "b.graphql"

type User {
id: ID!
name: String!
}
5 changes: 5 additions & 0 deletions fixtures/collision/b.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type User {
id: ID!
name: String
intro: String
}
11 changes: 11 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

0 comments on commit 96bad6d

Please sign in to comment.