Skip to content

Commit

Permalink
Merge pull request #146 from ipfs/fix#145
Browse files Browse the repository at this point in the history
fix: #145
  • Loading branch information
daviddias committed Jul 4, 2017
2 parents c925ad6 + c1062a7 commit fecdaaf
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Node.js implementation of the Bitswap data exchange protocol used by IPFS",
"main": "src/index.js",
"browser": {
"libp2p-ipfs-nodejs": false
"./test/libp2p-bundle": false
},
"scripts": {
"test": "aegir-test --dom",
Expand Down Expand Up @@ -42,7 +42,10 @@
"chai": "^4.0.2",
"dirty-chai": "^2.0.0",
"ipfs-repo": "~0.15.0",
"libp2p-ipfs-nodejs": "~301.0.0",
"libp2p": "^0.9.1",
"libp2p-multiplex": "^0.4.3",
"libp2p-secio": "^0.6.8",
"libp2p-tcp": "^0.10.1",
"lodash": "^4.17.4",
"multiaddr": "^2.3.0",
"ncp": "^2.0.0",
Expand Down Expand Up @@ -85,4 +88,4 @@
"greenkeeperio-bot <support@greenkeeper.io>",
"npmcdn-to-unpkg-bot <npmcdn-to-unpkg-bot@users.noreply.github.com>"
]
}
}
7 changes: 4 additions & 3 deletions test/browser.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* global self */
'use strict'

const IPFSRepo = require('ipfs-repo')
const series = require('async/series')

const idb = self.indexedDB ||
self.mozIndexedDB ||
self.webkitIndexedDB ||
self.msIndexedDB
self.mozIndexedDB ||
self.webkitIndexedDB ||
self.msIndexedDB

// book keeping
let dbs = []
Expand Down
2 changes: 1 addition & 1 deletion test/components/network/network.node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const Node = require('libp2p-ipfs-nodejs')
const Node = require('../../libp2p-bundle')
const PeerInfo = require('peer-info')
const chai = require('chai')
chai.use(require('dirty-chai'))
Expand Down
4 changes: 2 additions & 2 deletions test/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ module.exports = (repo) => {

bs.get(b.cid, (err, res) => {
expect(err).to.not.exist()
expect(res).to.be.empty()
expect(res).to.not.exist()
finish()
})
bs.get(b.cid, (err, res) => {
expect(err).to.not.exist()
expect(res).to.be.empty()
expect(res).to.not.exist()
finish()
})

Expand Down
25 changes: 25 additions & 0 deletions test/libp2p-bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict'

const TCP = require('libp2p-tcp')
const multiplex = require('libp2p-multiplex')
const secio = require('libp2p-secio')
const libp2p = require('libp2p')

class Node extends libp2p {
constructor (peerInfo, peerBook, options) {
options = options || {}

const modules = {
transport: [ new TCP() ],
connection: {
muxer: multiplex,
crypto: [ secio ]
},
discovery: []
}

super(modules, peerInfo, peerBook, options)
}
}

module.exports = Node
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const series = require('async/series')
const _ = require('lodash')
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const Node = require('libp2p-ipfs-nodejs')
const Node = require('./libp2p-bundle')
const os = require('os')
const Repo = require('ipfs-repo')
const multihashing = require('multihashing-async')
Expand Down

0 comments on commit fecdaaf

Please sign in to comment.