diff options
author | nkavian <nas@sixclovers.com> | 2021-07-10 01:00:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-10 01:00:12 +0300 |
commit | 5c79c0a01424087e4c37776d86ef745191504df4 (patch) | |
tree | 5debb550e0e14cbfafcd3cf9ae59b9e79507d290 /test/client-add.js | |
parent | a87ebbe8b86cd73b8d5b4402501595b358217e79 (diff) |
feat: support adding paused torrents. (#2004)
* Support adding paused torrents.
* chore: use arrows, because semantic
Co-authored-by: Nas Kavian <>
Co-authored-by: Diego RodrÃguez Baquero <github@diegorbaquero.com>
Diffstat (limited to 'test/client-add.js')
-rw-r--r-- | test/client-add.js | 21 |
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') }) + }) +}) |