Update libp2p-websockets and add test for callback's conn

This commit is contained in:
Francisco Baio Dias
2016-03-20 17:57:14 +00:00
parent 9d149caf15
commit f2df5586d5
2 changed files with 14 additions and 1 deletions

View File

@ -34,7 +34,7 @@
"istanbul": "^0.4.2", "istanbul": "^0.4.2",
"libp2p-spdy": "^0.2.3", "libp2p-spdy": "^0.2.3",
"libp2p-tcp": "^0.4.0", "libp2p-tcp": "^0.4.0",
"libp2p-websockets": "^0.2.0", "libp2p-websockets": "^0.2.1",
"mocha": "^2.4.5", "mocha": "^2.4.5",
"multiaddr": "^1.3.0", "multiaddr": "^1.3.0",
"peer-id": "^0.6.0", "peer-id": "^0.6.0",

View File

@ -232,6 +232,19 @@ describe('transport - websockets', function () {
conn.end() conn.end()
}) })
it('dial (conn from callback)', (done) => {
swarmA.transport.dial('ws', multiaddr('/ip4/127.0.0.1/tcp/9999/websockets'), (err, conn) => {
expect(err).to.not.exist
conn.pipe(bl((err, data) => {
expect(err).to.not.exist
done()
}))
conn.write('hey')
conn.end()
})
})
it('close', (done) => { it('close', (done) => {
var count = 0 var count = 0
swarmA.transport.close('ws', closed) swarmA.transport.close('ws', closed)