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
diff options
context:
space:
mode:
authorJulen Garcia Leunda <hicom150@gmail.com>2020-11-12 19:06:59 +0300
committerJulen Garcia Leunda <hicom150@gmail.com>2020-11-12 19:06:59 +0300
commit7c34ba107a094f170385c8a387a254b46052e9c7 (patch)
tree4ab77343360ff1c68274f2da1c149102599ddd62 /test/node/download-lsd-magnet.js
parent21fb2f8e02eaadaef3108a73a9dfd4579de74a6c (diff)
Fix tests disabling lsd option
Diffstat (limited to 'test/node/download-lsd-magnet.js')
-rw-r--r--test/node/download-lsd-magnet.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/node/download-lsd-magnet.js b/test/node/download-lsd-magnet.js
new file mode 100644
index 0000000..bbf9d32
--- /dev/null
+++ b/test/node/download-lsd-magnet.js
@@ -0,0 +1,37 @@
+const fixtures = require('webtorrent-fixtures')
+const MemoryChunkStore = require('memory-chunk-store')
+const test = require('tape')
+const WebTorrent = require('../../')
+
+test('Download using LSD (via magnet uri)', function (t) {
+ t.plan(3)
+
+ const client1 = new WebTorrent({ dht: false, tracker: false, lsd: true })
+ const client2 = new WebTorrent({ dht: false, tracker: false, lsd: true })
+
+ client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
+
+ 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
+ })
+
+ client2.on('listening', function () {
+ // Start downloading
+ const torrent = client1.add(fixtures.leaves.magnetURI, { store: MemoryChunkStore })
+
+ 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') })
+ })
+ })
+})