Skip to content

Commit

Permalink
test: add test for custom typename in query.auth path
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed May 30, 2020
1 parent 85a0e91 commit 4a091a2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/__snapshots__/astToSchema-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Query {
me(arg: Int): QueryMe
some: QuerySome
user: UserAwesomeType
auth: QueryAuth
auth: NamespaceCustomTypeName
}
type QueryMe {
Expand Down Expand Up @@ -45,7 +45,7 @@ type UserExtendedData {
starsCount: Int
}
type QueryAuth {
type NamespaceCustomTypeName {
isLoggedIn: Boolean
nested: QueryAuthNested
}
Expand Down
22 changes: 21 additions & 1 deletion src/__tests__/__snapshots__/directoryToAst-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,28 @@ exports[`directoryToAst() Schema ./__testSchema__ query has proper values 1`] =
Object {
"absPath": Any<String>,
"children": Object {
"auth": ObjectContaining {
"auth": Object {
"absPath": Any<String>,
"children": Object {
"isLoggedIn": ObjectContaining {
"kind": "file",
},
"nested": ObjectContaining {
"kind": "dir",
},
},
"kind": "dir",
"name": "auth",
"namespaceConfig": Object {
"absPath": "/Users/nodkz/www/_npm/graphql-compose-modules/src/__tests__/__testSchema__/query.auth/index.ts",
"code": Object {
"default": Object {
"type": "NamespaceCustomTypeName",
},
},
"kind": "file",
"name": "index",
},
},
"field": ObjectContaining {
"kind": "file",
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/__testSchema__/query.auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
type: 'NamespaceCustomTypeName',
};
10 changes: 9 additions & 1 deletion src/__tests__/directoryToAst-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ describe('directoryToAst()', () => {
kind: 'rootType',
absPath: expect.any(String),
children: {
auth: expect.objectContaining({ kind: 'dir' }),
auth: {
kind: 'dir',
name: 'auth',
absPath: expect.any(String),
children: {
isLoggedIn: expect.objectContaining({ kind: 'file' }),
nested: expect.objectContaining({ kind: 'dir' }),
},
},
field: expect.objectContaining({ kind: 'file' }),
me: {
absPath: expect.any(String),
Expand Down

0 comments on commit 4a091a2

Please sign in to comment.