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

Commit

Permalink
fix: removes error code checks for bitswap offline tests
Browse files Browse the repository at this point in the history
When run in the browser with js-ipfs-api against a stopped go-ipfs there is no error code, just a "Failed to fetch" message from the browser fetch API. The error `code` is specific to Node.js so this check has been removed.

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw committed Jun 18, 2018
1 parent 66c53f7 commit b152856
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions js/src/bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ module.exports = (common) => {
it('.stat gives error while offline', (done) => {
ipfs.bitswap.stat((err, stats) => {
expect(err).to.exist()
// When run against core we get our expected error, when run
// as part of the http tests we get a connection refused
if (err.code !== 'ECONNREFUSED') {
expect(err).to.match(/online mode/)
}
expect(stats).to.not.exist()
done()
})
Expand All @@ -133,11 +128,6 @@ module.exports = (common) => {
it('.wantlist gives error if offline', (done) => {
ipfs.bitswap.wantlist((err, list) => {
expect(err).to.exist()
// When run against core we get our expected error, when run
// as part of the http tests we get a connection refused
if (err.code !== 'ECONNREFUSED') {
expect(err).to.match(/online mode/)
}
expect(list).to.not.exist()
done()
})
Expand All @@ -147,11 +137,6 @@ module.exports = (common) => {
const key = 'QmUBdnXXPyoDFXj3Hj39dNJ5VkN3QFRskXxcGaYFBB8CNR'
ipfs.bitswap.unwant(key, (err) => {
expect(err).to.exist()
// When run against core we get our expected error, when run
// as part of the http tests we get a connection refused
if (err.code !== 'ECONNREFUSED') {
expect(err).to.match(/online mode/)
}
done()
})
})
Expand Down

0 comments on commit b152856

Please sign in to comment.