Skip to content

Commit

Permalink
fix download timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
guanzo committed Sep 8, 2023
1 parent 98ff5a4 commit 55da761
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/utils/timers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const setTimeoutPromise = async ms => {
export const setTimeoutPromise = async (ms, value = undefined) => {
return new Promise(resolve => {
setTimeout(resolve, ms)
setTimeout(() => resolve(value), ms)
})
}

Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Saturn client', () => {
})

it('should fail when exceeding download timeout', async () => {
await assert.rejects(client.fetchCID('QmXjYBY478Cno4jzdCcPy4NcJYFrwHZ51xaCP8vUwN9MGm', { downloadTimeout: 0 }))
await assert.rejects(client.fetchCID('QmXjYBY478Cno4jzdCcPy4NcJYFrwHZ51xaCP8vUwN9MGm/blah', { downloadTimeout: 1 }))
})
})
})

0 comments on commit 55da761

Please sign in to comment.