Skip to content

Commit 4a091a2

Browse files
committed
test: add test for custom typename in query.auth path
1 parent 85a0e91 commit 4a091a2

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

src/__tests__/__snapshots__/astToSchema-test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Query {
1212
me(arg: Int): QueryMe
1313
some: QuerySome
1414
user: UserAwesomeType
15-
auth: QueryAuth
15+
auth: NamespaceCustomTypeName
1616
}
1717
1818
type QueryMe {
@@ -45,7 +45,7 @@ type UserExtendedData {
4545
starsCount: Int
4646
}
4747
48-
type QueryAuth {
48+
type NamespaceCustomTypeName {
4949
isLoggedIn: Boolean
5050
nested: QueryAuthNested
5151
}

src/__tests__/__snapshots__/directoryToAst-test.ts.snap

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,28 @@ exports[`directoryToAst() Schema ./__testSchema__ query has proper values 1`] =
5656
Object {
5757
"absPath": Any<String>,
5858
"children": Object {
59-
"auth": ObjectContaining {
59+
"auth": Object {
60+
"absPath": Any<String>,
61+
"children": Object {
62+
"isLoggedIn": ObjectContaining {
63+
"kind": "file",
64+
},
65+
"nested": ObjectContaining {
66+
"kind": "dir",
67+
},
68+
},
6069
"kind": "dir",
70+
"name": "auth",
71+
"namespaceConfig": Object {
72+
"absPath": "/Users/nodkz/www/_npm/graphql-compose-modules/src/__tests__/__testSchema__/query.auth/index.ts",
73+
"code": Object {
74+
"default": Object {
75+
"type": "NamespaceCustomTypeName",
76+
},
77+
},
78+
"kind": "file",
79+
"name": "index",
80+
},
6181
},
6282
"field": ObjectContaining {
6383
"kind": "file",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
type: 'NamespaceCustomTypeName',
3+
};

src/__tests__/directoryToAst-test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ describe('directoryToAst()', () => {
1414
kind: 'rootType',
1515
absPath: expect.any(String),
1616
children: {
17-
auth: expect.objectContaining({ kind: 'dir' }),
17+
auth: {
18+
kind: 'dir',
19+
name: 'auth',
20+
absPath: expect.any(String),
21+
children: {
22+
isLoggedIn: expect.objectContaining({ kind: 'file' }),
23+
nested: expect.objectContaining({ kind: 'dir' }),
24+
},
25+
},
1826
field: expect.objectContaining({ kind: 'file' }),
1927
me: {
2028
absPath: expect.any(String),

0 commit comments

Comments
 (0)