diff --git a/package.json b/package.json index acb99735a5..b663ee34bb 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,11 @@ }, "homepage": "https://github.com/ipfs/js-ipfs#readme", "devDependencies": { - "aegir": "^9.1.2", + "aegir": "^9.2.0", "buffer-loader": "0.0.1", "chai": "^3.5.0", "detect-node": "^2.0.3", - "eslint-plugin-react": "^6.7.1", + "eslint-plugin-react": "^6.8.0", "execa": "^0.5.0", "expose-loader": "^0.7.1", "form-data": "^2.1.2", @@ -77,22 +77,22 @@ "debug": "^2.3.3", "fs-pull-blob-store": "^0.3.0", "glob": "^7.1.1", - "hapi": "^16.0.0", + "hapi": "^16.0.1", "hapi-set-header": "^1.0.2", "idb-pull-blob-store": "^0.5.1", - "ipfs-api": "^12.0.0", - "ipfs-bitswap": "^0.8.1", - "ipfs-block": "^0.5.0", - "ipfs-block-service": "^0.7.0", + "ipfs-api": "^12.0.3", + "ipfs-bitswap": "^0.8.2", + "ipfs-block": "^0.5.1", + "ipfs-block-service": "^0.7.1", "ipfs-multipart": "^0.1.0", "ipfs-repo": "^0.11.1", "ipfs-unixfs": "^0.1.8", - "ipfs-unixfs-engine": "^0.14.0", + "ipfs-unixfs-engine": "^0.14.1", "ipld-resolver": "^0.4.0", "isstream": "^0.1.2", - "joi": "^10.0.1", - "libp2p-ipfs-nodejs": "^0.16.1", - "libp2p-ipfs-browser": "^0.17.0", + "joi": "^10.0.5", + "libp2p-ipfs-nodejs": "^0.16.4", + "libp2p-ipfs-browser": "^0.17.1", "lodash.flatmap": "^4.5.0", "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", @@ -119,9 +119,9 @@ "stream-to-pull-stream": "^1.7.2", "tar-stream": "^1.5.2", "temp": "^0.8.3", - "through2": "^2.0.2", - "update-notifier": "^1.0.2", - "yargs": "^6.4.0" + "through2": "^2.0.3", + "update-notifier": "^1.0.3", + "yargs": "^6.5.0" }, "contributors": [ "Andrew de Andrade ", @@ -149,4 +149,4 @@ "nginnever ", "npmcdn-to-unpkg-bot " ] -} \ No newline at end of file +} diff --git a/test/core/both/test-bitswap.js b/test/core/both/test-bitswap.js index 576f93d8a3..f579cb5688 100644 --- a/test/core/both/test-bitswap.js +++ b/test/core/both/test-bitswap.js @@ -18,11 +18,12 @@ const isNode = require('detect-node') const IPFS = require('../../../src/core') -function makeBlock (cb) { - return cb(null, new Block(`IPFS is awesome ${Math.random()}`)) +function makeBlock (callback) { + const block = new Block(new Buffer(`IPFS is awesome ${Math.random()}`)) + callback(null, block) } -describe('bitswap', () => { +describe.only('bitswap', () => { let inProcNode // Node spawned inside this process let swarmAddrsBak @@ -68,8 +69,7 @@ describe('bitswap', () => { targetAddr = addr.encapsulate(multiaddr(`/ipfs/${identity.id}`)).toString() targetAddr = targetAddr.replace('0.0.0.0', '127.0.0.1') } else { - // Note: the browser doesn't have - // a websockets listening addr + // Note: the browser doesn't have a websockets listening addr // TODO, what we really need is a way to dial to // a peerId only and another to dial to peerInfo @@ -129,19 +129,34 @@ describe('bitswap', () => { remoteNode = res[1] cb() }, - (cb) => remoteNode.block.put(block, cb), - (res, cb) => block.key('sha2-256', cb), - (key, cb) => inProcNode.block.get(key, cb), + (cb) => { + remoteNode.block.put(block, (err, _block) => { + expect(err).to.not.exist + expect(block.data).to.eql(_block.data) + cb() + }) + }, + (cb) => block.key('sha2-256', cb), + (key, cb) => { + console.log('----> 1') + inProcNode.swarm.peers((err, peers) => { + expect(err).to.not.exist + console.log('Got %d peers', peers.length) + }) + + // remoteNode.block.get(key, cb) // for testing + inProcNode.block.get(key, cb) + }, (b, cb) => { - expect(b.data).to.be.eql(block.data) + console.log('----> 2') + + expect(b.data).to.eql(block.data) cb() } ], done) }) - it('3 peers', function (done) { - this.timeout(60 * 1000) - + it('3 peers', (done) => { let blocks let keys const remoteNodes = []