Skip to content

Commit

Permalink
test: check if external abort controller is used
Browse files Browse the repository at this point in the history
  • Loading branch information
guanzo committed Oct 12, 2023
1 parent b974bac commit 3cc7ca7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ describe('Saturn client', () => {
await assert.rejects(client.fetchCID(TEST_CID, { connectTimeout: 1 }))
})

it('should use external abort controller', async () => {
const controller = new AbortController()
setTimeout(() => controller.abort(), 5)

await assert.rejects(
client.fetchCID(TEST_CID, { controller }),
{
name: 'AbortError',
message: 'This operation was aborted'
}
)
})

it.skip('should fail when exceeding download timeout', async () => {
await assert.rejects(client.fetchCID(`${TEST_CID}/blah`, { downloadTimeout: 1 }))
})
Expand Down

0 comments on commit 3cc7ca7

Please sign in to comment.