Skip to content

Commit 670a312

Browse files
authored
test(execute): fix rogue test (#1538)
Ref #1530
1 parent 73ce2b3 commit 670a312

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/execute/main.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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',

0 commit comments

Comments
 (0)