Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikicho committed Mar 9, 2024
1 parent 3db1434 commit 40af138
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_fetch.js
Expand Up @@ -242,6 +242,22 @@ describe('Native Fetch', () => {
}
})

it('should delay the connection', async () => {
nock('http://example.test').get('/').delayBody(50).reply(200)

const start = Date.now()

const response = await fetch('http://example.test')

expect(response.status).to.equal(200)
// wait for body stream to complete
await response.text()
expect(Date.now() - start).to.be.at.least(
50,
'delay minimum not satisfied',
)
})

it('should delay the response body', async () => {
nock('http://example.test').get('/').delayBody(50).reply(200)

Expand Down

0 comments on commit 40af138

Please sign in to comment.