From 72876215b7515fc03339951660173276726937e8 Mon Sep 17 00:00:00 2001 From: David Dias Date: Sat, 22 Oct 2016 01:51:11 +0100 Subject: [PATCH] fix: bitswap mock test --- package.json | 7 ++++--- test/block-service-test.js | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 89305e4..b41bf47 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ipfs-block-service", "version": "0.5.0", "description": "JavaScript Implementation of BlockService", - "main": "src/index.js", + "main": "lib/index.js", "jsnext:main": "src/index.js", "scripts": { "lint": "aegir-lint", @@ -42,8 +42,8 @@ "chai": "^3.5.0", "fs-pull-blob-store": "^0.3.0", "idb-pull-blob-store": "^0.5.1", - "ipfs-block": "^0.3.0", - "ipfs-repo": "^0.9.0", + "ipfs-block": "^0.4.0", + "ipfs-repo": "^0.10.0", "lodash": "^4.15.0", "ncp": "^2.0.0", "pre-commit": "^1.1.3", @@ -51,6 +51,7 @@ "run-series": "^1.1.4" }, "dependencies": { + "cids": "^0.2.0", "pull-stream": "^3.4.5", "run-parallel-limit": "^1.0.3" }, diff --git a/test/block-service-test.js b/test/block-service-test.js index 0e54eb7..7e877a4 100644 --- a/test/block-service-test.js +++ b/test/block-service-test.js @@ -207,14 +207,17 @@ module.exports = (repo) => { const bitswap = { getStream (key) { return pull.values([ - new Block(key) + new Block('secret') ]) } } bs.goOnline(bitswap) - bs.get('secret', (err, block) => { + const block = new Block('secret') + const cid = new CID(block.key('sha2-256')) + + bs.get(cid, (err, block) => { expect(err).to.not.exist expect(block.data).to.be.eql(new Block('secret').data) done()