@@ -5,13 +5,13 @@ import { getIntrospectionQuery } from 'graphql';
5
5
import introspectionResponse from './fixtures/introspectionResponse.json' ;
6
6
7
7
describe ( 'getDiff' , ( ) => {
8
- describe . skip ( 'remote schema fetching' , ( ) => {
8
+ describe ( 'remote schema fetching' , ( ) => {
9
9
const testRemoteSchemaLocation = 'http://test/graphql' ;
10
10
const introspectionQuery = getIntrospectionQuery ( ) ;
11
11
12
12
it ( 'fetches remote schema successfully' , async ( ) => {
13
13
nock ( testRemoteSchemaLocation )
14
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
14
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
15
15
. twice ( )
16
16
. reply ( 200 , introspectionResponse ) ;
17
17
@@ -25,7 +25,7 @@ describe('getDiff', () => {
25
25
it ( 'fetches remote schemas with headers' , async ( ) => {
26
26
nock ( testRemoteSchemaLocation )
27
27
. matchHeader ( 'test' , 'test' )
28
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
28
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
29
29
. twice ( )
30
30
. reply ( 200 , introspectionResponse ) ;
31
31
@@ -45,11 +45,11 @@ describe('getDiff', () => {
45
45
const testRemoteRightSchemaLocation = 'http://testRight/graphql' ;
46
46
nock ( testRemoteSchemaLocation )
47
47
. matchHeader ( 'test' , 'left' )
48
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
48
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
49
49
. reply ( 200 , introspectionResponse ) ;
50
50
nock ( testRemoteRightSchemaLocation )
51
51
. matchHeader ( 'test' , 'right' )
52
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
52
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
53
53
. reply ( 200 , introspectionResponse ) ;
54
54
55
55
const result = await getDiff (
@@ -76,12 +76,12 @@ describe('getDiff', () => {
76
76
nock ( testRemoteSchemaLocation )
77
77
. matchHeader ( 'global' , 'merged' )
78
78
. matchHeader ( 'test' , 'left' )
79
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
79
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
80
80
. reply ( 200 , introspectionResponse ) ;
81
81
nock ( testRemoteRightSchemaLocation )
82
82
. matchHeader ( 'global' , 'merged' )
83
83
. matchHeader ( 'test' , 'right' )
84
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
84
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
85
85
. reply ( 200 , introspectionResponse ) ;
86
86
87
87
const result = await getDiff (
@@ -108,24 +108,24 @@ describe('getDiff', () => {
108
108
109
109
it ( 'throws error on status codes other than 200' , ( ) => {
110
110
nock ( testRemoteSchemaLocation )
111
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
111
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
112
112
. twice ( )
113
- . reply ( 404 ) ;
113
+ . reply ( 404 , { } ) ;
114
114
115
115
return expect (
116
116
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 / ) ;
118
118
} ) ;
119
119
120
120
it ( 'throws error on invalid response' , ( ) => {
121
121
nock ( testRemoteSchemaLocation )
122
- . post ( '' , JSON . stringify ( { query : introspectionQuery } ) )
122
+ . post ( / . * / , JSON . stringify ( { query : introspectionQuery } ) )
123
123
. twice ( )
124
124
. reply ( 200 , { invalid : 'response' } ) ;
125
125
126
126
return expect (
127
127
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 / ) ;
129
129
} ) ;
130
130
131
131
afterEach ( ( ) => {
0 commit comments