Skip to content

Commit

Permalink
test: adjust test
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov committed Sep 1, 2017
1 parent 8830ff1 commit 3c3ca5e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"devDependencies": {
"aegir": "^11.0.2",
"chai": "^4.1.1",
"dirty-chai": "^2.0.1",
"cids": "~0.5.1",
"libp2p-kad-dht": "~0.4.1",
"libp2p-mdns": "~0.8.0",
Expand Down
34 changes: 26 additions & 8 deletions test/nodejs-bundle/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ describe(`circuit`, function () {
`/ip4/0.0.0.0/tcp/9011`
], {
relay: {
circuit: {
enabled: true,
hop: {
enabled: true,
active: false // passive relay
}
Expand All @@ -72,9 +73,10 @@ describe(`circuit`, function () {
`/ip4/0.0.0.0/tcp/9111`
], {
relay: {
circuit: {
enabled: true,
hop: {
enabled: true,
active: true // active relay
active: false // passive relay
}
}
}, (node) => {
Expand All @@ -84,30 +86,46 @@ describe(`circuit`, function () {
// setup node with WS
(cb) => setupNode([
`/ip4/0.0.0.0/tcp/9210/ws`
], (node) => {
], {
relay: {
enabled: true
}
}, (node) => {
nodeWS1 = node
cb()
}),
// setup node with WS
(cb) => setupNode([
`/ip4/0.0.0.0/tcp/9410/ws`
], (node) => {
], {
relay: {
enabled: true
}
}, (node) => {
nodeWS2 = node
cb()
}),
// set up node with TCP and listening on relay1
(cb) => setupNode([
`/ip4/0.0.0.0/tcp/9211`,
`/ipfs/${relayNode1.peerInfo.id.toB58String()}/p2p-circuit`
], (node) => {
], {
relay: {
enabled: true
}
}, (node) => {
nodeTCP1 = node
cb()
}),
// set up node with TCP and listening on relay2 over TCP transport
(cb) => setupNode([
`/ip4/0.0.0.0/tcp/9311`,
`/ip4/0.0.0.0/tcp/9111/ipfs/${relayNode2.peerInfo.id.toB58String()}/p2p-circuit`
], (node) => {
], {
relay: {
enabled: true
}
}, (node) => {
nodeTCP2 = node
cb()
})
Expand Down Expand Up @@ -173,7 +191,7 @@ describe(`circuit`, function () {
expect(e).to.not.exist()
expect(result[0].toString()).to.equal('hello')

const addr = multiaddr(handlerSpies[0].args[1][0].dstPeer.addrs[0]).toString()
const addr = multiaddr(handlerSpies[0].args[2][0].dstPeer.addrs[0]).toString()
expect(addr).to.equal(`/ipfs/${nodeTCP1.peerInfo.id.toB58String()}`)
done()
})
Expand Down

0 comments on commit 3c3ca5e

Please sign in to comment.