diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f722787..0fa0f7007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ + +## [0.36.1](https://github.com/ipfs/interface-ipfs-core/compare/v0.36.0...v0.36.1) (2017-11-17) + + + # [0.36.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.35.0...v0.36.0) (2017-11-17) diff --git a/package.json b/package.json index 04ccb1b3a..6138cd61b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interface-ipfs-core", - "version": "0.36.0", + "version": "0.36.1", "description": "A test suite and interface you can use to implement a IPFS core interface.", "main": "src/index.js", "scripts": { diff --git a/src/files.js b/src/files.js index 3dde439a6..4db8778d6 100644 --- a/src/files.js +++ b/src/files.js @@ -15,6 +15,7 @@ const Readable = require('readable-stream').Readable const pull = require('pull-stream') const concat = require('concat-stream') const through = require('through2') +const path = require('path') const bl = require('bl') module.exports = (common) => { @@ -129,6 +130,15 @@ module.exports = (common) => { }) }) + it('add by path fails', (done) => { + const validPath = path.join(process.cwd() + '/package.json') + + ipfs.files.add(validPath, (err, res) => { + expect(err).to.exist() + done() + }) + }) + it('a Readable Stream', (done) => { const expectedCid = 'QmVv4Wz46JaZJeH5PMV4LGbRiiMKEmszPYY3g6fjGnVXBS' @@ -209,14 +219,14 @@ module.exports = (common) => { accumProgress += p } - ipfs.files.add(dirs, { progress: handler }, (err, res) => { + ipfs.files.add(dirs, { progress: handler }, (err, filesAdded) => { expect(err).to.not.exist() - const root = res[res.length - 1] + const root = filesAdded[filesAdded.length - 1] - expect(root.path).to.equal('test-folder') - expect(root.hash).to.equal(directory.cid) expect(progCount).to.equal(8) expect(accumProgress).to.be.at.least(total) + expect(root.path).to.equal('test-folder') + expect(root.hash).to.equal(directory.cid) done() }) }) @@ -729,6 +739,22 @@ module.exports = (common) => { done() }) }) + + it('should correctly handle a non existing hash', (done) => { + ipfs.ls('surelynotavalidhashheh?', (err, res) => { + expect(err).to.exist() + expect(res).to.not.exist() + done() + }) + }) + + it('should correctly handle a non exiting path', (done) => { + ipfs.ls('QmRNjDeKStKGTQXnJ2NFqeQ9oW/folder_that_isnt_there', (err, res) => { + expect(err).to.exist() + expect(res).to.not.exist() + done() + }) + }) }) describe('.lsReadableStream', () => {