File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,10 @@ describe('execute', () => {
120120 } )
121121 } )
122122
123- test ( 'should execute a simple get request with user-defined fetch' , ( ) => {
123+ test ( 'should execute a simple get request with user-defined fetch' , async ( ) => {
124+ // cross-fetch exposes FetchAPI methods onto global
125+ require ( 'cross-fetch/polyfill' )
126+
124127 // Given
125128 const spec = {
126129 host : 'swagger.io' ,
@@ -134,13 +137,15 @@ describe('execute', () => {
134137 }
135138 }
136139
137- const spy = jest . fn ( ) . mockImplementation ( ( ) => Promise . resolve ( ) )
140+ // eslint-disable-next-line no-undef
141+ const spy = jest . fn ( ) . mockImplementation ( ( ) => Promise . resolve ( new Response ( 'data' ) ) )
138142
139- execute ( {
143+ await execute ( {
140144 userFetch : spy ,
141145 spec,
142146 operationId : 'getMe'
143147 } )
148+
144149 expect ( spy . mock . calls . length ) . toEqual ( 1 )
145150 expect ( spy . mock . calls [ 0 ] [ 1 ] ) . toEqual ( {
146151 method : 'GET' ,
You can’t perform that action at this time.
0 commit comments