diff options
author | Bruce Hopkins <behopkinsjr@gmail.com> | 2022-02-03 23:32:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 23:32:52 +0300 |
commit | 051fea3223d85f3d1a681b98b8d889810d7ad38d (patch) | |
tree | 9f0eed4ae0e4cfe88de0af1c5a35bcf38d33bbbf /test | |
parent | ef52a00e5bd987ef7f86bb6fb2c48572d5e6dcc2 (diff) |
refactor: Return Torrent when client.seed finds a duplicate (#2239)
* refactor: passes duplicate torrent in cb when creating seed
* refactor: seed method passes torrent if duplicate
* refactor: seed method passes torrent if duplicate
* refactor: return Torrent when client.seed finds a duplicate
* fix:changed warning
Co-authored-by: Diego RodrÃguez Baquero <github@diegorbaquero.com>
Co-authored-by: Bruce-Hopkins <behopkins@gmail.com>
Co-authored-by: Diego RodrÃguez Baquero <github@diegorbaquero.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/client-seed.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/client-seed.js b/test/client-seed.js index edf399a..2a5d1ce 100644 --- a/test/client-seed.js +++ b/test/client-seed.js @@ -74,3 +74,22 @@ test('client.seed: torrent file (Blob)', t => { client.destroy(err => { t.error(err, 'client destroyed') }) }) }) + +test('client.seed: duplicate seed)', t => { + t.plan(4) + + const client = new WebTorrent() + + client.on('error', err => { t.fail(err) }) + client.on('warning', err => { t.fail(err) }) + + client.seed(fixtures.leaves.content, function (torrent1) { + client.seed(fixtures.leaves.content, function (torrent2) { + t.equal(torrent1, torrent2) + t.equal(client.torrents.length, 1) + + client.destroy(err => { t.error(err, 'client destroyed') }) + t.equal(client.torrents.length, 0) + }) + }) +}) |