mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-24 18:02:28 +00:00
open stream in both sides test
This commit is contained in:
parent
8853a85d91
commit
9de74aea84
@ -48,6 +48,38 @@ module.exports.all = function (test, common) {
|
||||
})
|
||||
})
|
||||
|
||||
test('Open a stream on both sides', function (t) {
|
||||
common.setup(test, function (err, Muxer) {
|
||||
t.plan(7)
|
||||
t.ifError(err, 'Should not throw')
|
||||
|
||||
var pair = streamPair.create()
|
||||
var dialer = new Muxer()
|
||||
var listener = new Muxer()
|
||||
|
||||
var connDialer = dialer.attach(pair, false)
|
||||
var connListener = listener.attach(pair.other, true)
|
||||
|
||||
connDialer.dialStream(function (err, stream) {
|
||||
t.ifError(err, 'Should not throw')
|
||||
t.pass('dialed stream from dialer')
|
||||
})
|
||||
|
||||
connListener.on('stream', function (stream) {
|
||||
t.pass('listener got stream')
|
||||
})
|
||||
|
||||
connListener.dialStream(function (err, stream) {
|
||||
t.ifError(err, 'Should not throw')
|
||||
t.pass('dialed stream from listener')
|
||||
})
|
||||
|
||||
connDialer.on('stream', function (stream) {
|
||||
t.pass('dialer got stream')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Open a stream using the net.connect pattern', function (t) {
|
||||
common.setup(test, function (err, Muxer) {
|
||||
t.plan(3)
|
||||
|
@ -1,6 +1,6 @@
|
||||
module.exports = function (test, common, mega) {
|
||||
require('./base-test.js').all(test, common)
|
||||
require('./stress-test.js').all(test, common)
|
||||
// require('./stress-test.js').all(test, common)
|
||||
if (mega) {
|
||||
require('./mega-stress-test.js').all(test, common)
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ module.exports.all = function (test, common) {
|
||||
spawnGeneration(t, Muxer, pair, pair.other, 1000, 100)
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function spawnGeneration (t, Muxer, dialerSocket, listenerSocket, nStreams, nMsg, size) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user