@@ -2,7 +2,6 @@ import { ApolloServer } from '@apollo/server';
2
2
import { startStandaloneServer } from '@apollo/server/standalone' ;
3
3
import fetch from 'make-fetch-happen' ;
4
4
import assert from 'assert' ;
5
- import { version as graphqlVersion } from 'graphql' ;
6
5
7
6
// validate all deep imports
8
7
await import ( '@apollo/server' ) ;
@@ -46,27 +45,23 @@ const { url } = await startStandaloneServer(s, { listen: { port: 0 } });
46
45
}
47
46
48
47
if ( process . env . INCREMENTAL_DELIVERY_TESTS_ENABLED ) {
49
- const specVersion =
50
- graphqlVersion === '17.0.0-alpha.9'
51
- ? 'incrementalDeliverySpec=3283f8a'
52
- : 'deferSpec=20220824' ;
53
- const response = await fetch ( url , {
54
- method : 'POST' ,
55
- headers : {
56
- 'content-type' : 'application/json' ,
57
- accept : `multipart/mixed; ${ specVersion } , application/json` ,
58
- } ,
59
- body : JSON . stringify ( { query : '{h1: hello ...@defer{ h2: hello }}' } ) ,
60
- } ) ;
48
+ {
49
+ const response = await fetch ( url , {
50
+ method : 'POST' ,
51
+ headers : {
52
+ 'content-type' : 'application/json' ,
53
+ accept : `multipart/mixed; deferSpec=20220824, application/json` ,
54
+ } ,
55
+ body : JSON . stringify ( { query : '{h1: hello ...@defer{ h2: hello }}' } ) ,
56
+ } ) ;
61
57
62
- assert . strictEqual (
63
- response . headers . get ( 'content-type' ) ,
64
- `multipart/mixed; boundary="-"; ${ specVersion } ` ,
65
- ) ;
58
+ assert . strictEqual (
59
+ response . headers . get ( 'content-type' ) ,
60
+ `multipart/mixed; boundary="-"; deferSpec=20220824 ` ,
61
+ ) ;
66
62
67
- const body = await response . text ( ) ;
63
+ const body = await response . text ( ) ;
68
64
69
- if ( graphqlVersion === '17.0.0-alpha.2' ) {
70
65
assert . strictEqual (
71
66
body ,
72
67
'\r\n' +
@@ -80,7 +75,25 @@ if (process.env.INCREMENTAL_DELIVERY_TESTS_ENABLED) {
80
75
'{"hasNext":false,"incremental":[{"path":[],"data":{"h2":"world"}}]}\r\n' +
81
76
'-----\r\n' ,
82
77
) ;
83
- } else {
78
+ }
79
+
80
+ {
81
+ const response = await fetch ( url , {
82
+ method : 'POST' ,
83
+ headers : {
84
+ 'content-type' : 'application/json' ,
85
+ accept : `multipart/mixed; incrementalDeliverySpec=3283f8a, application/json` ,
86
+ } ,
87
+ body : JSON . stringify ( { query : '{h1: hello ...@defer{ h2: hello }}' } ) ,
88
+ } ) ;
89
+
90
+ assert . strictEqual (
91
+ response . headers . get ( 'content-type' ) ,
92
+ `multipart/mixed; boundary="-"; incrementalDeliverySpec=3283f8a` ,
93
+ ) ;
94
+
95
+ const body = await response . text ( ) ;
96
+
84
97
assert . strictEqual (
85
98
body ,
86
99
'\r\n' +
@@ -96,6 +109,7 @@ if (process.env.INCREMENTAL_DELIVERY_TESTS_ENABLED) {
96
109
) ;
97
110
}
98
111
}
112
+
99
113
await s . stop ( ) ;
100
114
101
115
console . log ( 'ESM smoke test passed!' ) ;
0 commit comments