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() }) })