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

Commit 5df0715

Browse files
committed
added a promises test
1 parent 5af0641 commit 5df0715

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/files.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,23 @@ module.exports = (common) => {
109109
expect(err).to.not.exist
110110
})
111111
})
112+
113+
it('returns error on invalid key', (done) => {
114+
const hash = 'somethingNotMultihash'
115+
ipfs.cat(hash)
116+
.then((stream) => {})
117+
.catch((err) => {
118+
expect(err).to.exist
119+
const errString = err.toString()
120+
if (errString === 'Error: invalid ipfs ref path') {
121+
expect(err.toString()).to.contain('Error: invalid ipfs ref path')
122+
}
123+
if (errString === 'Error: Invalid Key') {
124+
expect(err.toString()).to.contain('Error: Invalid Key')
125+
}
126+
done()
127+
})
128+
})
112129
})
113130
})
114131
})

0 commit comments

Comments
 (0)