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:
Diffstat (limited to 'test')
-rw-r--r--test/basic.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/basic.js b/test/basic.js
index 2630f04..26b543b 100644
--- a/test/basic.js
+++ b/test/basic.js
@@ -326,3 +326,20 @@ test('after client.destroy(), no "torrent" or "ready" events emitted', function
client.destroy(function (err) { t.error(err, 'client destroyed') })
})
+
+test('client.add: invalid torrent id: empty string', function (t) {
+ t.plan(3)
+
+ var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) {
+ t.ok(err instanceof Error)
+ t.ok(err.message.indexOf('Invalid torrent identifier') >= 0)
+
+ client.destroy(function (err) { t.error(err, 'client destroyed') })
+ })
+ client.on('warning', function (err) { t.fail(err) })
+
+ client.add('')
+})
+