From 08baee2ddd7a194d44fc797e704b7a6b71304423 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 21 Apr 2016 01:15:44 -0700 Subject: set dhtPort to correct port after listening --- test/node/download-dht-magnet.js | 6 +++++- test/node/download-dht-torrent.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'test') 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) }) -- cgit v1.2.3