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:
authorJonathan Harper <jharper@eecs.berkeley.edu>2016-04-27 06:59:29 +0300
committerJonathan Harper <jharper@eecs.berkeley.edu>2016-04-27 07:12:25 +0300
commitcd7fcb2d797cccf9507557493146e6a498f16861 (patch)
tree746c1471b2be54b5597c04b80838958d92c0094c /test
parent4e28de9e5df522689b18f4c76fffedea66fa156d (diff)
Torrent emits 'noPeers' even when swarm is empty after announce
Diffstat (limited to 'test')
-rw-r--r--test/node/download-dht-torrent.js9
-rw-r--r--test/node/download-tracker-magnet.js6
2 files changed, 13 insertions, 2 deletions
diff --git a/test/node/download-dht-torrent.js b/test/node/download-dht-torrent.js
index 20c7b0c..874288d 100644
--- a/test/node/download-dht-torrent.js
+++ b/test/node/download-dht-torrent.js
@@ -53,10 +53,17 @@ test('Download using DHT (via .torrent file)', function (t) {
maybeDone(null)
})
+ torrent.on('noPeers', function (announceType) {
+ t.equal(announceType, 'dht', 'noPeers event seen with correct announceType')
+ noPeersFound = true
+ maybeDone(null)
+ })
+
var announced = false
var loaded = false
+ var noPeersFound = false
function maybeDone (err) {
- if ((announced && loaded) || err) cb(err, client1)
+ if ((announced && loaded && noPeersFound) || err) cb(err, client1)
}
},
diff --git a/test/node/download-tracker-magnet.js b/test/node/download-tracker-magnet.js
index a310350..7224895 100644
--- a/test/node/download-tracker-magnet.js
+++ b/test/node/download-tracker-magnet.js
@@ -15,7 +15,7 @@ test('Download using HTTP tracker (via magnet uri)', function (t) {
})
function magnetDownloadTest (t, serverType) {
- t.plan(9)
+ t.plan(10)
var tracker = new TrackerServer(
serverType === 'udp' ? { http: false, ws: false } : { udp: false, ws: false }
@@ -59,6 +59,10 @@ function magnetDownloadTest (t, serverType) {
'Leaves of Grass by Walt Whitman.epub'
]
+ torrent.on('noPeers', function (announceType) {
+ t.equal(announceType, 'tracker', 'noPeers event seen with correct announceType')
+ })
+
t.deepEqual(torrent.files.map(function (file) { return file.name }), names)
torrent.load(fs.createReadStream(fixtures.leaves.contentPath), function (err) {