diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-07-23 04:11:18 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-07-23 04:11:18 +0300 |
commit | f2282dcecc8ea3ea9afff5ecf7f41b764cc8bc9b (patch) | |
tree | f9c8bca1cbb45ca36192922a34ef45dd3802b14c /test/node | |
parent | f0f9dc179fd15cc7928acac9b8b73c4d675fc142 (diff) |
test: make more reliable with once
Okay, so this was a timing thing. Basically now noPeers is getting
emitted twice because the tracker gets sent a 'started' then a
'completed' message and both times there are no peers in the response.
I changed the .on('noPeers') to .once('noPeers') so this will be more
reliable.
https://github.com/feross/webtorrent/pull/871#discussion_r71963946
Diffstat (limited to 'test/node')
-rw-r--r-- | test/node/download-tracker-magnet.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/node/download-tracker-magnet.js b/test/node/download-tracker-magnet.js index 97062c0..9ffa233 100644 --- a/test/node/download-tracker-magnet.js +++ b/test/node/download-tracker-magnet.js @@ -16,7 +16,7 @@ test('Download using HTTP tracker (via magnet uri)', function (t) { }) function magnetDownloadTest (t, serverType) { - t.plan(11) + t.plan(10) var tracker = new TrackerServer( serverType === 'udp' ? { http: false, ws: false } : { udp: false, ws: false } @@ -60,7 +60,7 @@ function magnetDownloadTest (t, serverType) { 'Leaves of Grass by Walt Whitman.epub' ] - torrent.on('noPeers', function (announceType) { + torrent.once('noPeers', function (announceType) { t.equal(announceType, 'tracker', 'noPeers event seen with correct announceType') }) |