diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-04-21 11:15:44 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-04-21 11:15:44 +0300 |
commit | 08baee2ddd7a194d44fc797e704b7a6b71304423 (patch) | |
tree | d09791a359a25a85c456a560f35a148bd53b35d2 /test/node | |
parent | 63e4aee7bd016f258d81708af9c03cf608968816 (diff) |
set dhtPort to correct port after listening
Diffstat (limited to 'test/node')
-rw-r--r-- | test/node/download-dht-magnet.js | 6 | ||||
-rw-r--r-- | test/node/download-dht-torrent.js | 6 |
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) }) |