File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,17 @@ describe('getDiff', () => {
116116 ) . rejects . toThrow ( `404 - Not Found (${ testRemoteSchemaLocation } )` ) ;
117117 } ) ;
118118
119+ it ( 'throws error on invalid response' , ( ) => {
120+ nock ( testRemoteSchemaLocation )
121+ . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
122+ . twice ( )
123+ . reply ( 200 , { invalid : 'response' } ) ;
124+
125+ return expect (
126+ getDiff ( testRemoteSchemaLocation , testRemoteSchemaLocation )
127+ ) . rejects . toThrow ( `Invalid response from GraphQL endpoint: ${ testRemoteSchemaLocation } ` ) ;
128+ } ) ;
129+
119130 afterEach ( ( ) => {
120131 nock . cleanAll ( ) ;
121132 } ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ async function fetchRemoteSchema(
3737 }
3838
3939 const responseBody = await res . json ( ) ;
40-
40+
4141 if ( ! responseBody || ! responseBody . data || ! responseBody . data . __schema ) {
4242 throw new Error ( `Invalid response from GraphQL endpoint: ${ endpoint } ` ) ;
4343 }
You can’t perform that action at this time.
0 commit comments