File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ import { buildASTSchema } from '../buildASTSchema';
20
20
* into an in-memory GraphQLSchema, and then finally
21
21
* printing that GraphQL into the DSL
22
22
*/
23
- function cycleOutput ( body , queryType ) {
23
+ function cycleOutput ( body , queryType , mutationType ) {
24
24
var ast = parseSchemaIntoAST ( body ) ;
25
- var schema = buildASTSchema ( ast , queryType ) ;
25
+ var schema = buildASTSchema ( ast , queryType , mutationType ) ;
26
26
return '\n' + printSchema ( schema ) ;
27
27
}
28
28
@@ -231,6 +231,22 @@ type Hello {
231
231
var output = cycleOutput ( body , 'Hello' ) ;
232
232
expect ( output ) . to . equal ( body ) ;
233
233
} ) ;
234
+
235
+ it ( 'Simple type with mutation' , ( ) => {
236
+ var body = `
237
+ type HelloScalars {
238
+ str: String
239
+ int: Int
240
+ bool: Boolean
241
+ }
242
+
243
+ type Mutation {
244
+ addHelloScalars(str: String, int: Int, bool: Boolean): HelloScalars
245
+ }
246
+ ` ;
247
+ var output = cycleOutput ( body , 'HelloScalars' , 'Mutation' ) ;
248
+ expect ( output ) . to . equal ( body ) ;
249
+ } ) ;
234
250
} ) ;
235
251
236
252
describe ( 'Schema Parser Failures' , ( ) => {
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export function buildASTSchema(
151
151
schema = new GraphQLSchema ( { query : queryType } ) ;
152
152
} else {
153
153
schema = new GraphQLSchema ( {
154
- query : queryTypeName ,
154
+ query : queryType ,
155
155
mutation : produceTypeDef ( astMap [ mutationTypeName ] ) ,
156
156
} ) ;
157
157
}
You can’t perform that action at this time.
0 commit comments