Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 89a12d1

Browse files
author
Alan Shaw
committed
fix: assert on error code if available
1 parent 2735dcf commit 89a12d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/object/stat.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ module.exports = (common, options) => {
6060
const err = await expect(ipfs.object.stat(badCid, { timeout: `${timeout}s` })).to.be.rejected()
6161
const timeForRequest = (new Date() - startTime) / 1000
6262

63-
expect(err).to.have.property('message', 'failed to get block for QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3MzzzzzZ: context deadline exceeded')
63+
if (err.code) {
64+
expect(err.code).to.equal('ERR_TIMEOUT')
65+
} else {
66+
expect(err.message).to.equal('failed to get block for QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3MzzzzzZ: context deadline exceeded')
67+
}
68+
6469
expect(timeForRequest).to.not.lessThan(timeout)
6570
expect(timeForRequest).to.not.greaterThan(timeout + 1)
6671
})

0 commit comments

Comments
 (0)