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:
Diffstat (limited to 'test')
-rw-r--r--test/client-add.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/client-add.js b/test/client-add.js
index beced07..90231fc 100644
--- a/test/client-add.js
+++ b/test/client-add.js
@@ -205,3 +205,24 @@ test('client.add: invalid torrent id: short buffer', function (t) {
client.add(Buffer.from('abc'))
})
+
+test('client.add: paused torrent', function (t) {
+ t.plan(5)
+
+ const client = new WebTorrent({ dht: false, tracker: false, lsd: false })
+
+ client.on('error', (err) => t.fail(err))
+ client.on('warning', (err) => t.fail(err))
+
+ const torrent = client.add(fixtures.leaves.magnetURI, { paused: true })
+ t.equal(client.torrents.length, 1)
+
+ torrent.on('infoHash', function () {
+ t.equal(torrent.paused, true)
+
+ client.remove(fixtures.leaves.magnetURI, function (err) { t.error(err, 'torrent destroyed') })
+ t.equal(client.torrents.length, 0)
+
+ client.destroy(function (err) { t.error(err, 'client destroyed') })
+ })
+})