From 9940742d4e1873877c72128d2da80ae68a9de4dd Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 12 Aug 2016 18:42:52 +0100 Subject: [PATCH 1/2] feat(files.add): conform with latest interface-ipfs-core spec --- src/add-to-dagnode-transform.js | 3 ++- test/interface-ipfs-core/files.spec.js | 9 ++++----- test/interface-ipfs-core/get.spec.js | 8 +++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/add-to-dagnode-transform.js b/src/add-to-dagnode-transform.js index f70d869f9..55e6c90eb 100644 --- a/src/add-to-dagnode-transform.js +++ b/src/add-to-dagnode-transform.js @@ -16,7 +16,8 @@ module.exports = function (err, res, send, done) { } var obj = { path: entry.Name, - node: node + hash: entry.Hash, + size: node.size() } next(null, obj) }) diff --git a/test/interface-ipfs-core/files.spec.js b/test/interface-ipfs-core/files.spec.js index d504fb596..d40187b6a 100644 --- a/test/interface-ipfs-core/files.spec.js +++ b/test/interface-ipfs-core/files.spec.js @@ -7,7 +7,6 @@ const expect = require('chai').expect const isNode = require('detect-node') const path = require('path') const test = require('interface-ipfs-core') -const bs58 = require('bs58') const fs = require('fs') const FactoryClient = require('../factory/factory-client') const testfile = fs.readFileSync(path.join(__dirname, '/../data/testfile.txt')) @@ -30,14 +29,14 @@ test.files(common) // mfs tests describe('.files (pseudo mfs)', () => { it('add file for testing', (done) => { + const expectedMultihash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP' + apiClients.a.files.add(testfile, (err, res) => { expect(err).to.not.exist expect(res).to.have.length(1) - const mh = bs58.encode(res[0].node.multihash()).toString() - expect(mh).to.equal('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP') - expect(res[0].path).to.equal(mh) - expect(res[0].node.links).to.have.length(0) + expect(res[0].hash).to.equal(expectedMultihash) + expect(res[0].path).to.equal(expectedMultihash) done() }) }) diff --git a/test/interface-ipfs-core/get.spec.js b/test/interface-ipfs-core/get.spec.js index 4a15577f7..2bf1f9f73 100644 --- a/test/interface-ipfs-core/get.spec.js +++ b/test/interface-ipfs-core/get.spec.js @@ -8,7 +8,6 @@ const expect = require('chai').expect const isNode = require('detect-node') const fs = require('fs') const concat = require('concat-stream') -const bs58 = require('bs58') const through = require('through2') const streamEqual = require('stream-equal') const path = require('path') @@ -92,15 +91,14 @@ describe('.get', () => { } const bigFile = fs.readFileSync(tfbPath) + const expectedMultihash = 'Qme79tX2bViL26vNjPsF3DP1R9rMKMvnPYJiKTTKPrXJjq' apiClients.a.files.add(bigFile, (err, res) => { expect(err).to.not.exist expect(res).to.have.length(1) - expect(res[0].node.links).to.have.length(58) - const mh = bs58.encode(res[0].node.multihash()).toString() - expect(res[0].path).to.equal(mh) - expect(mh).to.equal('Qme79tX2bViL26vNjPsF3DP1R9rMKMvnPYJiKTTKPrXJjq') + expect(res[0].path).to.equal(expectedMultihash) + expect(res[0].hash).to.equal(expectedMultihash) done() }) }) From 8a984a8310c7bbfdabb7da1a2a52595e5db7c6d7 Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 12 Aug 2016 21:01:38 +0100 Subject: [PATCH 2/2] feat(ci): add node.js 6 (stable) testing --- .travis.yml | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e1d6320be..d86ec626d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: node_js node_js: - 4 - 5 + - "stable" # Make sure we have new NPM. before_install: diff --git a/package.json b/package.json index f4950b6f7..b92a6397b 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "chai": "^3.5.0", "gulp": "^3.9.1", "hapi": "^14.1.0", - "interface-ipfs-core": "^0.7.2", + "interface-ipfs-core": "^0.8.0", "ipfsd-ctl": "^0.14.0", "passthrough-counter": "^1.0.0", "pre-commit": "^1.1.3",