mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
test: update tests to use libp2p-mplex module
This commit is contained in:
parent
10a8ec3f31
commit
14d3578eaf
@ -60,14 +60,14 @@ describe('stream muxing', () => {
|
||||
], done)
|
||||
})
|
||||
|
||||
it('multiplex only', (done) => {
|
||||
it('mplex only', (done) => {
|
||||
let nodeA
|
||||
let nodeB
|
||||
|
||||
function setup (callback) {
|
||||
parallel([
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['multiplex']
|
||||
muxer: ['mplex']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeA = node
|
||||
@ -75,7 +75,7 @@ describe('stream muxing', () => {
|
||||
node.start(cb)
|
||||
}),
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['multiplex']
|
||||
muxer: ['mplex']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeB = node
|
||||
@ -92,7 +92,7 @@ describe('stream muxing', () => {
|
||||
], done)
|
||||
})
|
||||
|
||||
it('spdy + multiplex', function (done) {
|
||||
it('spdy + mplex', function (done) {
|
||||
this.timeout(5000)
|
||||
|
||||
let nodeA
|
||||
@ -101,7 +101,7 @@ describe('stream muxing', () => {
|
||||
function setup (callback) {
|
||||
parallel([
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['spdy', 'multiplex']
|
||||
muxer: ['spdy', 'mplex']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeA = node
|
||||
@ -109,7 +109,7 @@ describe('stream muxing', () => {
|
||||
node.start(cb)
|
||||
}),
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['spdy', 'multiplex']
|
||||
muxer: ['spdy', 'mplex']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeB = node
|
||||
@ -126,7 +126,7 @@ describe('stream muxing', () => {
|
||||
], done)
|
||||
})
|
||||
|
||||
it('spdy + multiplex switched order', function (done) {
|
||||
it('spdy + mplex switched order', function (done) {
|
||||
this.timeout(5 * 1000)
|
||||
|
||||
let nodeA
|
||||
@ -135,7 +135,7 @@ describe('stream muxing', () => {
|
||||
function setup (callback) {
|
||||
parallel([
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['spdy', 'multiplex']
|
||||
muxer: ['spdy', 'mplex']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeA = node
|
||||
@ -143,7 +143,7 @@ describe('stream muxing', () => {
|
||||
node.start(cb)
|
||||
}),
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['multiplex', 'spdy']
|
||||
muxer: ['mplex', 'spdy']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeB = node
|
||||
@ -177,7 +177,7 @@ describe('stream muxing', () => {
|
||||
node.start(cb)
|
||||
}),
|
||||
(cb) => createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
muxer: ['multiplex']
|
||||
muxer: ['mplex']
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist()
|
||||
nodeB = node
|
||||
|
@ -48,12 +48,12 @@ describe('transports', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('create libp2pNode with multiplex only', (done) => {
|
||||
it('create libp2pNode with mplex only', (done) => {
|
||||
PeerInfo.create((err, peerInfo) => {
|
||||
expect(err).to.not.exist()
|
||||
|
||||
const b = new Node(peerInfo, null, { muxer: ['multiplex'] })
|
||||
expect(b.modules.connection.muxer).to.eql([require('libp2p-multiplex')])
|
||||
const b = new Node(peerInfo, null, { muxer: ['mplex'] })
|
||||
expect(b.modules.connection.muxer).to.eql([require('libp2p-mplex')])
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ const WS = require('libp2p-websockets')
|
||||
const WebRTCStar = require('libp2p-webrtc-star')
|
||||
const WebSocketStar = require('libp2p-websocket-star')
|
||||
const spdy = require('libp2p-spdy')
|
||||
const multiplex = require('libp2p-multiplex')
|
||||
const mplex = require('libp2p-mplex')
|
||||
const secio = require('libp2p-secio')
|
||||
const Railing = require('libp2p-railing')
|
||||
const libp2p = require('../..')
|
||||
@ -17,8 +17,8 @@ function mapMuxers (list) {
|
||||
switch (pref.trim().toLowerCase()) {
|
||||
case 'spdy':
|
||||
return spdy
|
||||
case 'multiplex':
|
||||
return multiplex
|
||||
case 'mplex':
|
||||
return mplex
|
||||
default:
|
||||
throw new Error(pref + ' muxer not available')
|
||||
}
|
||||
@ -29,7 +29,7 @@ function getMuxers (options) {
|
||||
if (options) {
|
||||
return mapMuxers(options)
|
||||
} else {
|
||||
return [multiplex, spdy]
|
||||
return [mplex, spdy]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ const WS = require('libp2p-websockets')
|
||||
const Railing = require('libp2p-railing')
|
||||
const spdy = require('libp2p-spdy')
|
||||
const KadDHT = require('libp2p-kad-dht')
|
||||
const multiplex = require('libp2p-multiplex')
|
||||
const mplex = require('libp2p-mplex')
|
||||
const secio = require('libp2p-secio')
|
||||
const libp2p = require('../..')
|
||||
|
||||
@ -17,7 +17,7 @@ function mapMuxers (list) {
|
||||
}
|
||||
switch (pref.trim().toLowerCase()) {
|
||||
case 'spdy': return spdy
|
||||
case 'multiplex': return multiplex
|
||||
case 'mplex': return mplex
|
||||
default:
|
||||
throw new Error(pref + ' muxer not available')
|
||||
}
|
||||
@ -31,7 +31,7 @@ function getMuxers (muxers) {
|
||||
} else if (muxers) {
|
||||
return mapMuxers(muxers)
|
||||
} else {
|
||||
return [multiplex, spdy]
|
||||
return [mplex, spdy]
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user