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:
authorJulen Garcia Leunda <hicom150@gmail.com>2020-11-14 19:41:05 +0300
committerJulen Garcia Leunda <hicom150@gmail.com>2020-11-14 19:41:05 +0300
commit462eccb6e47c4440332d6ed2a1110516cf77bd80 (patch)
tree1b914dd0b7287d3a9b608af50e4e4fa77e988af6 /test
parenta89f269cd838e54440eac87769a9c23b8d6b0f20 (diff)
Fix review suggestions
Diffstat (limited to 'test')
-rw-r--r--test/node/download-lsd-magnet.js18
-rw-r--r--test/node/download-lsd-torrent.js26
2 files changed, 17 insertions, 27 deletions
diff --git a/test/node/download-lsd-magnet.js b/test/node/download-lsd-magnet.js
index bbf9d32..a3b956e 100644
--- a/test/node/download-lsd-magnet.js
+++ b/test/node/download-lsd-magnet.js
@@ -15,23 +15,17 @@ test('Download using LSD (via magnet uri)', function (t) {
client2.on('error', function (err) { t.fail(err) })
client2.on('warning', function (err) { t.fail(err) })
- // Start seeding
+ const torrent = client1.add(fixtures.leaves.magnetURI, { store: MemoryChunkStore })
+
client2.seed(fixtures.leaves.content, {
name: 'Leaves of Grass by Walt Whitman.epub',
announce: []
- }, function (torrent) {
- torrent.discovery.lsd._announce() // hack to send a lsd announce skipping 5min interval
})
- client2.on('listening', function () {
- // Start downloading
- const torrent = client1.add(fixtures.leaves.magnetURI, { store: MemoryChunkStore })
-
- torrent.on('done', function () {
- t.pass()
+ torrent.on('done', function () {
+ t.pass()
- client1.destroy(function (err) { t.error(err, 'client 1 destroyed') })
- client2.destroy(function (err) { t.error(err, 'client 2 destroyed') })
- })
+ client1.destroy(function (err) { t.error(err, 'client 1 destroyed') })
+ client2.destroy(function (err) { t.error(err, 'client 2 destroyed') })
})
})
diff --git a/test/node/download-lsd-torrent.js b/test/node/download-lsd-torrent.js
index 163069d..719a491 100644
--- a/test/node/download-lsd-torrent.js
+++ b/test/node/download-lsd-torrent.js
@@ -15,23 +15,19 @@ test('Download using LSD (via .torrent file)', function (t) {
client2.on('error', function (err) { t.fail(err) })
client2.on('warning', function (err) { t.fail(err) })
- // Start seeding
- client2.seed(fixtures.leaves.content, {
- name: 'Leaves of Grass by Walt Whitman.epub',
- announce: []
- }, function (torrent) {
- torrent.discovery.lsd._announce() // // hack to send a lsd announce skipping 5min interval
- })
+ const torrent = client1.add(fixtures.leaves.parsedTorrent, { store: MemoryChunkStore })
- client2.on('torrent', function () {
- // Start downloading
- const torrent = client1.add(fixtures.leaves.parsedTorrent, { store: MemoryChunkStore })
+ client1.on('torrent', function () {
+ client2.seed(fixtures.leaves.content, {
+ name: 'Leaves of Grass by Walt Whitman.epub',
+ announce: []
+ })
+ })
- torrent.on('done', function () {
- t.pass()
+ torrent.on('done', function () {
+ t.pass()
- client1.destroy(function (err) { t.error(err, 'client 1 destroyed') })
- client2.destroy(function (err) { t.error(err, 'client 2 destroyed') })
- })
+ client1.destroy(function (err) { t.error(err, 'client 1 destroyed') })
+ client2.destroy(function (err) { t.error(err, 'client 2 destroyed') })
})
})