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:
authorFeross Aboukhadijeh <feross@feross.org>2016-01-09 20:50:26 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-01-09 20:50:33 +0300
commitd573c1fdc047c6d8d0f07fc6224f6d9ab34c755a (patch)
treeb6f29cf7551a0ae6dd8f943177c89df1c639546b /test/duplicate.js
parente3136dab854985b906493f587e2fc7306b8f3a72 (diff)
test: add test that duplicate announce urls are removed
Diffstat (limited to 'test/duplicate.js')
-rw-r--r--test/duplicate.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/duplicate.js b/test/duplicate.js
new file mode 100644
index 0000000..66e8fd2
--- /dev/null
+++ b/test/duplicate.js
@@ -0,0 +1,22 @@
+var common = require('./common')
+var test = require('tape')
+var WebTorrent = require('../')
+
+test('client.add: magnet uri, utf-8 string', function (t) {
+ t.plan(3)
+
+ var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
+ var torrent = client.add(common.leaves.torrent, {
+ announce: [ 'wss://example.com', 'wss://example.com', 'wss://example.com' ]
+ })
+
+ torrent.on('ready', function () {
+ t.equal(torrent.magnetURI, common.leaves.magnetURI + '&tr=' + encodeURIComponent('wss://example.com'))
+ client.remove(common.leaves.magnetURI, function (err) { t.error(err, 'torrent destroyed') })
+ client.destroy(function (err) { t.error(err, 'client destroyed') })
+ })
+})