File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ import { buildASTSchema } from '../buildASTSchema';
2020 * into an in-memory GraphQLSchema, and then finally
2121 * printing that GraphQL into the DSL
2222 */
23- function cycleOutput ( body , queryType ) {
23+ function cycleOutput ( body , queryType , mutationType ) {
2424 var ast = parseSchemaIntoAST ( body ) ;
25- var schema = buildASTSchema ( ast , queryType ) ;
25+ var schema = buildASTSchema ( ast , queryType , mutationType ) ;
2626 return '\n' + printSchema ( schema ) ;
2727}
2828
@@ -231,6 +231,22 @@ type Hello {
231231 var output = cycleOutput ( body , 'Hello' ) ;
232232 expect ( output ) . to . equal ( body ) ;
233233 } ) ;
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+ } ) ;
234250} ) ;
235251
236252describe ( 'Schema Parser Failures' , ( ) => {
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export function buildASTSchema(
151151 schema = new GraphQLSchema ( { query : queryType } ) ;
152152 } else {
153153 schema = new GraphQLSchema ( {
154- query : queryTypeName ,
154+ query : queryType ,
155155 mutation : produceTypeDef ( astMap [ mutationTypeName ] ) ,
156156 } ) ;
157157 }
You can’t perform that action at this time.
0 commit comments