Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-04-21 11:15:44 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-04-21 11:15:44 +0300
commit08baee2ddd7a194d44fc797e704b7a6b71304423 (patch)
treed09791a359a25a85c456a560f35a148bd53b35d2 /test
parent63e4aee7bd016f258d81708af9c03cf608968816 (diff)
set dhtPort to correct port after listening
Diffstat (limited to 'test')
-rw-r--r--test/node/download-dht-magnet.js6
-rw-r--r--test/node/download-dht-torrent.js6
2 files changed, 10 insertions, 2 deletions
diff --git a/test/node/download-dht-magnet.js b/test/node/download-dht-magnet.js
index 028d6a6..760bb26 100644
--- a/test/node/download-dht-magnet.js
+++ b/test/node/download-dht-magnet.js
@@ -7,7 +7,7 @@ var test = require('tape')
var WebTorrent = require('../../')
test('Download using DHT (via magnet uri)', function (t) {
- t.plan(11)
+ t.plan(12)
var dhtServer = new DHT({ bootstrap: false })
@@ -27,6 +27,10 @@ test('Download using DHT (via magnet uri)', function (t) {
dht: { bootstrap: '127.0.0.1:' + dhtServer.address().port, host: networkAddress.ipv4() }
})
+ client1.dht.on('listening', function () {
+ t.equal(client1.dhtPort, client1.dht.address().port)
+ })
+
client1.on('error', function (err) { t.fail(err) })
client1.on('warning', function (err) { t.fail(err) })
diff --git a/test/node/download-dht-torrent.js b/test/node/download-dht-torrent.js
index 5f88da5..20c7b0c 100644
--- a/test/node/download-dht-torrent.js
+++ b/test/node/download-dht-torrent.js
@@ -6,7 +6,7 @@ var test = require('tape')
var WebTorrent = require('../../')
test('Download using DHT (via .torrent file)', function (t) {
- t.plan(8)
+ t.plan(9)
var dhtServer = new DHT({ bootstrap: false })
@@ -26,6 +26,10 @@ test('Download using DHT (via .torrent file)', function (t) {
dht: { bootstrap: '127.0.0.1:' + dhtServer.address().port }
})
+ client1.dht.on('listening', function () {
+ t.equal(client1.dhtPort, client1.dht.address().port)
+ })
+
client1.on('error', function (err) { t.fail(err) })
client1.on('warning', function (err) { t.fail(err) })