diff options
-rw-r--r-- | test/duplicate.js | 22 |
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') }) + }) +}) |