From 8e3ae1f7a544c1bd9880f4548fdf2bd2642fb52c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 1 Jan 2016 20:53:53 +0100 Subject: test: client.add: invalid torrent id: invalid filesystem path --- test/node/basic.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/node') diff --git a/test/node/basic.js b/test/node/basic.js index c03eb93..b225b8d 100644 --- a/test/node/basic.js +++ b/test/node/basic.js @@ -114,3 +114,19 @@ test('client.seed: filesystem path to folder with multiple files, string', funct client.destroy(function (err) { t.error(err, 'client destroyed') }) }) }) + +test('client.add: invalid torrent id: invalid filesystem path', 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('/invalid/filesystem/path/123') +}) -- cgit v1.2.3