Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 7287621

Browse files
committed
fix: bitswap mock test
1 parent e92a118 commit 7287621

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ipfs-block-service",
33
"version": "0.5.0",
44
"description": "JavaScript Implementation of BlockService",
5-
"main": "src/index.js",
5+
"main": "lib/index.js",
66
"jsnext:main": "src/index.js",
77
"scripts": {
88
"lint": "aegir-lint",
@@ -42,15 +42,16 @@
4242
"chai": "^3.5.0",
4343
"fs-pull-blob-store": "^0.3.0",
4444
"idb-pull-blob-store": "^0.5.1",
45-
"ipfs-block": "^0.3.0",
46-
"ipfs-repo": "^0.9.0",
45+
"ipfs-block": "^0.4.0",
46+
"ipfs-repo": "^0.10.0",
4747
"lodash": "^4.15.0",
4848
"ncp": "^2.0.0",
4949
"pre-commit": "^1.1.3",
5050
"rimraf": "^2.5.4",
5151
"run-series": "^1.1.4"
5252
},
5353
"dependencies": {
54+
"cids": "^0.2.0",
5455
"pull-stream": "^3.4.5",
5556
"run-parallel-limit": "^1.0.3"
5657
},

test/block-service-test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,17 @@ module.exports = (repo) => {
207207
const bitswap = {
208208
getStream (key) {
209209
return pull.values([
210-
new Block(key)
210+
new Block('secret')
211211
])
212212
}
213213
}
214214

215215
bs.goOnline(bitswap)
216216

217-
bs.get('secret', (err, block) => {
217+
const block = new Block('secret')
218+
const cid = new CID(block.key('sha2-256'))
219+
220+
bs.get(cid, (err, block) => {
218221
expect(err).to.not.exist
219222
expect(block.data).to.be.eql(new Block('secret').data)
220223
done()

0 commit comments

Comments
 (0)