Skip to content

Commit

Permalink
test: getMany test
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Apr 16, 2017
1 parent 84cb6b3 commit f1ede87
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = (repo) => {
before((done) => {
parallel([
(cb) => repo.create('hello', cb),
(cb) => map(_.range(12), (i, cb) => makeBlock(cb), cb),
(cb) => map(_.range(15), (i, cb) => makeBlock(cb), cb),
(cb) => map(_.range(2), (i, cb) => PeerId.create(cb), cb)
], (err, results) => {
if (err) {
Expand Down Expand Up @@ -201,6 +201,29 @@ module.exports = (repo) => {
})

it('blocks exist locally', (done) => {
const b1 = blocks[3]
const b2 = blocks[14]
const b3 = blocks[13]

store.putMany([b1, b2, b3], (err) => {
expect(err).to.not.exist()

const book = new PeerBook()
const bs = new Bitswap(libp2pMock, store, book)

bs.getMany([
b1.cid,
b2.cid,
b3.cid
], (err, res) => {
expect(err).to.not.exist()
expect(res).to.be.eql([b1, b2, b3])
done()
})
})
})

it('getMany', (done) => {
const b1 = blocks[5]
const b2 = blocks[6]
const b3 = blocks[7]
Expand Down

0 comments on commit f1ede87

Please sign in to comment.