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

Commit

Permalink
fix: bitswap mock test
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Oct 26, 2016
1 parent e92a118 commit 7287621
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -42,15 +42,16 @@
"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",
"rimraf": "^2.5.4",
"run-series": "^1.1.4"
},
"dependencies": {
"cids": "^0.2.0",
"pull-stream": "^3.4.5",
"run-parallel-limit": "^1.0.3"
},
Expand Down
7 changes: 5 additions & 2 deletions test/block-service-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7287621

Please sign in to comment.