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-02-22 05:31:18 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-02-22 05:31:18 +0300
commitaadcb1c16585772adc3969e3a96823eeafe1dc05 (patch)
tree9999a6dccdc487ff4f12436c00a166056cb3d681 /test
parent66e8be7a12c22276bcb94ba81dcc5da3a41ceeda (diff)
test: add successive sync client.add, client.remove, client.add, client.remove
Diffstat (limited to 'test')
-rw-r--r--test/node/duplicates.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/node/duplicates.js b/test/node/duplicates.js
index d54abdd..0421546 100644
--- a/test/node/duplicates.js
+++ b/test/node/duplicates.js
@@ -54,3 +54,27 @@ test('client.seed followed by two duplicate client.add calls', function (t) {
})
})
})
+
+test('successive sync client.add, client.remove, client.add, client.remove', function (t) {
+ t.plan(3)
+
+ var client = new WebTorrent({ dht: false, tracker: false })
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
+ client.seed(common.leaves.content, {
+ name: 'Leaves of Grass by Walt Whitman.epub'
+ }, function (torrent1) {
+ t.equal(client.torrents.length, 1)
+
+ client.add(torrent1.infoHash)
+ client.remove(torrent1.infoHash)
+ client.add(torrent1.infoHash)
+ client.remove(torrent1.infoHash, function () {
+ client.destroy(function (err) {
+ t.error(err, 'destroyed client')
+ t.equal(client.torrents.length, 0)
+ })
+ })
+ })
+})