@@ -52,16 +52,15 @@ describe('buildRequest - openapi 2.0', () => {
52
52
test . skip ( 'should (Live) POST multipart-formdata with entry item entries' , ( ) => {
53
53
return fetch ( 'http://localhost:3300/api/v1/formdata' , { // eslint-disable-line no-undef
54
54
method : 'POST' ,
55
- body : req . body . stream , // per formdata-node docs
56
- headers : req . body . headers // per formdata-node docs
55
+ body : req . body
57
56
} )
58
57
. then ( ( res ) => {
59
58
return res . json ( )
60
59
} )
61
60
. then ( ( json ) => {
62
- expect ( json . email . length ) . toEqual ( 2 )
63
- expect ( json . email [ 0 ] ) . toEqual ( 'person1' )
64
- expect ( json . email [ 1 ] ) . toEqual ( 'person2' )
61
+ expect ( json . data . email . length ) . toEqual ( 2 )
62
+ expect ( json . data . email [ 0 ] ) . toEqual ( 'person1' )
63
+ expect ( json . data . email [ 1 ] ) . toEqual ( 'person2' )
65
64
} )
66
65
} )
67
66
@@ -84,8 +83,8 @@ describe('buildRequest - openapi 2.0', () => {
84
83
85
84
return fetch ( 'http://localhost:3300/api/v1/formdata' , { // eslint-disable-line no-undef
86
85
method : 'POST' ,
87
- body : req . body . stream , // per formdata-node docs
88
- headers : req . body . headers // per formdata-node docs
86
+ body : req . body ,
87
+ headers : req . headers
89
88
} )
90
89
. then ( ( res ) => {
91
90
return res . json ( )
@@ -94,10 +93,10 @@ describe('buildRequest - openapi 2.0', () => {
94
93
expect ( json . data . email . length ) . toEqual ( 2 )
95
94
expect ( json . data . email [ 0 ] ) . toEqual ( 'person1' )
96
95
expect ( json . data . email [ 1 ] ) . toEqual ( 'person2' )
97
- // duck typing that fetch received a formdata-node Stream instead of plain object
96
+ // duck typing that fetch received a FormData instance instead of plain object
98
97
const lastOptions = fetchMock . lastOptions ( )
99
98
expect ( lastOptions . body . readable ) . toEqual ( true )
100
- expect ( lastOptions . body . _readableState ) . toBeDefined ( )
99
+ // expect(lastOptions.body._streams ).toBeDefined()
101
100
} )
102
101
} )
103
102
} )
@@ -139,16 +138,15 @@ describe('buildRequest - openapi 3.0', () => {
139
138
test . skip ( 'should (Live) POST multipart-formdata with entry item entries' , ( ) => {
140
139
return fetch ( 'http://localhost:3300/api/v1/formdata' , { // eslint-disable-line no-undef
141
140
method : 'POST' ,
142
- body : req . body . stream , // per formdata-node docs
143
- headers : req . body . headers // per formdata-node docs
141
+ body : req . body
144
142
} )
145
143
. then ( ( res ) => {
146
144
return res . json ( )
147
145
} )
148
146
. then ( ( json ) => {
149
- expect ( json . email . length ) . toEqual ( 2 )
150
- expect ( json . email [ 0 ] ) . toEqual ( 'person1' )
151
- expect ( json . email [ 1 ] ) . toEqual ( 'person2' )
147
+ expect ( json . data . email . length ) . toEqual ( 2 )
148
+ expect ( json . data . email [ 0 ] ) . toEqual ( 'person1' )
149
+ expect ( json . data . email [ 1 ] ) . toEqual ( 'person2' )
152
150
} )
153
151
} )
154
152
@@ -171,8 +169,7 @@ describe('buildRequest - openapi 3.0', () => {
171
169
172
170
return fetch ( 'http://localhost:3300/api/v1/formdata' , { // eslint-disable-line no-undef
173
171
method : 'POST' ,
174
- body : req . body . stream , // per formdata-node docs
175
- headers : req . body . headers // per formdata-node docs
172
+ body : req . body ,
176
173
} )
177
174
. then ( ( res ) => {
178
175
return res . json ( )
@@ -181,10 +178,10 @@ describe('buildRequest - openapi 3.0', () => {
181
178
expect ( json . data . email . length ) . toEqual ( 2 )
182
179
expect ( json . data . email [ 0 ] ) . toEqual ( 'person1' )
183
180
expect ( json . data . email [ 1 ] ) . toEqual ( 'person2' )
184
- // duck typing that fetch received a formdata-node Stream instead of plain object
181
+ // duck typing that fetch received a FormData instance instead of plain object
185
182
const lastOptions = fetchMock . lastOptions ( )
186
183
expect ( lastOptions . body . readable ) . toEqual ( true )
187
- expect ( lastOptions . body . _readableState ) . toBeDefined ( )
184
+ // expect(lastOptions.body._streams ).toBeDefined()
188
185
} )
189
186
} )
190
187
} )
0 commit comments