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

Commit 56525cc

Browse files
jacobheundaviddias
authored andcommitted
test: add failing test for file.cat with cid instance
License: MIT Signed-off-by: Jacob Heun <[email protected]>
1 parent c3f832a commit 56525cc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

js/src/files.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const through = require('through2')
1818
const path = require('path')
1919
const bl = require('bl')
2020
const isNode = require('detect-node')
21+
const CID = require('cids')
2122

2223
module.exports = (common) => {
2324
describe('.files', function () {
@@ -375,6 +376,16 @@ module.exports = (common) => {
375376
})
376377
})
377378

379+
it('with a cid object', (done) => {
380+
const cid = new CID(smallFile.cid)
381+
382+
ipfs.files.cat(cid, (err, data) => {
383+
expect(err).to.not.exist()
384+
expect(data.toString()).to.contain('Plz add me!')
385+
done()
386+
})
387+
})
388+
378389
it('streams a large file', (done) => {
379390
ipfs.files.cat(bigFile.cid, (err, data) => {
380391
expect(err).to.not.exist()

0 commit comments

Comments
 (0)