@@ -5,13 +5,13 @@ import { getIntrospectionQuery } from 'graphql';
55import introspectionResponse from './fixtures/introspectionResponse.json' ;
66
77describe ( 'getDiff' , ( ) => {
8- describe . skip ( 'remote schema fetching' , ( ) => {
8+ describe ( 'remote schema fetching' , ( ) => {
99 const testRemoteSchemaLocation = 'http://test/graphql' ;
1010 const introspectionQuery = getIntrospectionQuery ( ) ;
1111
1212 it ( 'fetches remote schema successfully' , async ( ) => {
1313 nock ( testRemoteSchemaLocation )
14- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
14+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
1515 . twice ( )
1616 . reply ( 200 , introspectionResponse ) ;
1717
@@ -25,7 +25,7 @@ describe('getDiff', () => {
2525 it ( 'fetches remote schemas with headers' , async ( ) => {
2626 nock ( testRemoteSchemaLocation )
2727 . matchHeader ( 'test' , 'test' )
28- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
28+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
2929 . twice ( )
3030 . reply ( 200 , introspectionResponse ) ;
3131
@@ -45,11 +45,11 @@ describe('getDiff', () => {
4545 const testRemoteRightSchemaLocation = 'http://testRight/graphql' ;
4646 nock ( testRemoteSchemaLocation )
4747 . matchHeader ( 'test' , 'left' )
48- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
48+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
4949 . reply ( 200 , introspectionResponse ) ;
5050 nock ( testRemoteRightSchemaLocation )
5151 . matchHeader ( 'test' , 'right' )
52- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
52+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
5353 . reply ( 200 , introspectionResponse ) ;
5454
5555 const result = await getDiff (
@@ -76,12 +76,12 @@ describe('getDiff', () => {
7676 nock ( testRemoteSchemaLocation )
7777 . matchHeader ( 'global' , 'merged' )
7878 . matchHeader ( 'test' , 'left' )
79- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
79+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
8080 . reply ( 200 , introspectionResponse ) ;
8181 nock ( testRemoteRightSchemaLocation )
8282 . matchHeader ( 'global' , 'merged' )
8383 . matchHeader ( 'test' , 'right' )
84- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
84+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
8585 . reply ( 200 , introspectionResponse ) ;
8686
8787 const result = await getDiff (
@@ -108,24 +108,24 @@ describe('getDiff', () => {
108108
109109 it ( 'throws error on status codes other than 200' , ( ) => {
110110 nock ( testRemoteSchemaLocation )
111- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
111+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
112112 . twice ( )
113- . reply ( 404 ) ;
113+ . reply ( 404 , { } ) ;
114114
115115 return expect (
116116 getDiff ( testRemoteSchemaLocation , testRemoteSchemaLocation )
117- ) . rejects . toThrow ( `404 - Not Found ( ${ testRemoteSchemaLocation } )` ) ;
117+ ) . rejects . toThrow ( / U n a b l e t o d o w n l o a d s c h e m a f r o m r e m o t e / ) ;
118118 } ) ;
119119
120120 it ( 'throws error on invalid response' , ( ) => {
121121 nock ( testRemoteSchemaLocation )
122- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
122+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
123123 . twice ( )
124124 . reply ( 200 , { invalid : 'response' } ) ;
125125
126126 return expect (
127127 getDiff ( testRemoteSchemaLocation , testRemoteSchemaLocation )
128- ) . rejects . toThrow ( `Invalid response from GraphQL endpoint: ${ testRemoteSchemaLocation } ` ) ;
128+ ) . rejects . toThrow ( / U n a b l e t o d o w n l o a d s c h e m a f r o m r e m o t e / ) ;
129129 } ) ;
130130
131131 afterEach ( ( ) => {
0 commit comments