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:
authorBruce Hopkins <behopkinsjr@gmail.com>2022-02-03 23:32:52 +0300
committerGitHub <noreply@github.com>2022-02-03 23:32:52 +0300
commit051fea3223d85f3d1a681b98b8d889810d7ad38d (patch)
tree9f0eed4ae0e4cfe88de0af1c5a35bcf38d33bbbf /test
parentef52a00e5bd987ef7f86bb6fb2c48572d5e6dcc2 (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.js19
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)
+ })
+ })
+})