File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,9 +9,13 @@ export const composeCreateMocksForSchema =
99 ( createMocks , mockQuery , mockMutation ) =>
1010 ( schema , db , options ) => {
1111 let typesAndMockFns = [
12- [ schema . _queryType , mockQuery ] ,
13- [ schema . _mutationType , mockMutation ]
12+ [ schema . _queryType , mockQuery ]
1413 ] ;
14+
15+ if ( schema . _mutationType ) {
16+ typesAndMockFns . push ( [ schema . _mutationType , mockMutation ] ) ;
17+ }
18+
1519 let mocks = createMocks ( typesAndMockFns , db , options ) ;
1620
1721 return mocks ;
Original file line number Diff line number Diff line change @@ -23,6 +23,21 @@ module('Unit | Mocks | create', function() {
2323
2424 createMocksForSchema ( schema , db , options ) ;
2525 } ) ;
26+
27+ test ( 'it creates mocks for query type, if no mutation type' , function ( assert ) {
28+ assert . expect ( 1 ) ;
29+
30+ let schema = { _queryType : { } } ;
31+ let createMocks = ( typesAndMockFns ) => {
32+ assert . deepEqual ( typesAndMockFns , [
33+ [ schema . _queryType , null ]
34+ ] , 'It received the query type to mock' ) ;
35+ } ;
36+ let createMocksForSchema =
37+ composeCreateMocksForSchema ( createMocks , null , null ) ;
38+
39+ createMocksForSchema ( schema ) ;
40+ } ) ;
2641 } ) ;
2742
2843 module ( 'reduce mocks' , function ( ) {
You can’t perform that action at this time.
0 commit comments