mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-24 17:52:21 +00:00
more tests and readme up
This commit is contained in:
parent
1d0cc68645
commit
43e6ccf0f6
@ -13,7 +13,7 @@ The API is presented with both Node.js and Go primitives, however, there is not
|
|||||||
|
|
||||||
# Modules that implement the interface
|
# Modules that implement the interface
|
||||||
|
|
||||||
-
|
- [https://github.com/diasdavid/node-spdy-stream-muxer](Node.js spdy-stream-muxer) - stream-muxer abstraction on top of [spdy-transport](https://github.com/indutny/spdy-transport)
|
||||||
|
|
||||||
Send a PR to add a new one if you happen to find or write one.
|
Send a PR to add a new one if you happen to find or write one.
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/diasdavid/abstract-stream-muxer",
|
"homepage": "https://github.com/diasdavid/abstract-stream-muxer",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"dev-null": "^0.1.1",
|
||||||
"stream-pair": "^1.0.3"
|
"stream-pair": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,22 @@
|
|||||||
/* knobs - nStreams, nMsg, sizeMsg[low, high] */
|
|
||||||
|
|
||||||
var streamPair = require('stream-pair')
|
var streamPair = require('stream-pair')
|
||||||
|
var devNull = require('dev-null')
|
||||||
|
|
||||||
module.exports.all = function (test, common) {
|
module.exports.all = function (test, common) {
|
||||||
|
|
||||||
test('Open a stream from the dealer', function (t) {
|
test('1 stream with 10Mb file', function (t) {
|
||||||
common.setup(test, function (err, Muxer) {
|
common.setup(test, function (err, Muxer) {
|
||||||
t.plan(4)
|
t.ifError(err, 'should not throw')
|
||||||
t.ifError(err, 'Should not throw')
|
|
||||||
|
|
||||||
var pair = streamPair.create()
|
var pair = streamPair.create()
|
||||||
var dialer = new Muxer()
|
|
||||||
var listener = new Muxer()
|
|
||||||
|
|
||||||
var connDialer = dialer.attach(pair)
|
spawnGeneration(t, Muxer, pair, pair.other, 1, [10, 10])
|
||||||
var connListener = listener.attach(pair.other)
|
|
||||||
|
|
||||||
connDialer.dialStream(function (err, stream) {
|
|
||||||
t.ifError(err, 'Should not throw')
|
|
||||||
t.pass('dialed stream')
|
|
||||||
})
|
|
||||||
|
|
||||||
connListener.on('stream', function (stream) {
|
|
||||||
t.pass('got stream')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function spawnGeneration (t, Muxer, dialerSocket, listenerSocket, nStreams, sizeWindow) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function randSizeMsg (sizeWindow) {
|
||||||
|
return Math.floor(Math.random() * (sizeWindow[1] - sizeWindow[0] + 1)) + sizeWindow[0]
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user