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:
authorFeross Aboukhadijeh <feross@feross.org>2015-07-27 03:14:49 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-07-27 03:14:49 +0300
commit66ab7d24251a9c2816beca2fc17d9a1785427a49 (patch)
treebbfe3b75e720b352083483f58dfca7d156102bf6 /test
parentd8bceb285aa84ffcd0df2346075d4cd688c4003f (diff)
stricter tests: 'warning' events are failures
Diffstat (limited to 'test')
-rw-r--r--test/basic-node.js20
-rw-r--r--test/basic.js48
-rw-r--r--test/blocklist-dht.js7
-rw-r--r--test/blocklist-tracker.js2
-rw-r--r--test/blocklist.js8
-rw-r--r--test/cmd.js4
-rw-r--r--test/download-dht-magnet.js7
-rw-r--r--test/download-dht-torrent.js7
-rw-r--r--test/download-tracker-magnet.js7
-rw-r--r--test/download-tracker-torrent.js7
-rw-r--r--test/download-webseed-magnet.js4
-rw-r--r--test/duplicates.js5
-rw-r--r--test/extensions.js7
-rw-r--r--test/metadata.js10
-rw-r--r--test/server.js6
15 files changed, 124 insertions, 25 deletions
diff --git a/test/basic-node.js b/test/basic-node.js
index 12a27ed..cfdc70f 100644
--- a/test/basic-node.js
+++ b/test/basic-node.js
@@ -24,6 +24,10 @@ test('client.add: http url to a torrent file, string', function (t) {
var port = server.address().port
var url = 'http://127.0.0.1:' + port
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.add(url, function (torrent) {
t.equal(torrent.infoHash, leavesTorrent.infoHash)
t.equal(torrent.magnetURI, leavesMagnetURI)
@@ -37,6 +41,10 @@ test('client.add: filesystem path to a torrent file, string', function (t) {
t.plan(2)
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.add(leavesPath, function (torrent) {
t.equal(torrent.infoHash, leavesTorrent.infoHash)
t.equal(torrent.magnetURI, leavesMagnetURI)
@@ -60,6 +68,10 @@ test('client.seed: filesystem path to file, string', function (t) {
}
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.seed(leavesBookPath, opts, function (torrent) {
t.equal(torrent.infoHash, leavesTorrent.infoHash)
t.equal(torrent.magnetURI, leavesMagnetURI)
@@ -82,6 +94,10 @@ test('client.seed: filesystem path to folder with one file, string', function (t
}
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.seed(folderPath, opts, function (torrent) {
t.equal(torrent.infoHash, '3a686c32404af0a66913dd5f8d2b40673f8d4490')
t.equal(torrent.magnetURI, 'magnet:?xt=urn:btih:3a686c32404af0a66913dd5f8d2b40673f8d4490&dn=folder&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80')
@@ -101,6 +117,10 @@ test('client.seed: filesystem path to folder with multiple files, string', funct
}
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.seed(numbersPath, opts, function (torrent) {
t.equal(torrent.infoHash, '80562f38656b385ea78959010e51a2cc9db41ea0')
t.equal(torrent.magnetURI, 'magnet:?xt=urn:btih:80562f38656b385ea78959010e51a2cc9db41ea0&dn=numbers&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.webtorrent.io%3A80&tr=wss%3A%2F%2Ftracker.webtorrent.io')
diff --git a/test/basic.js b/test/basic.js
index aab3f72..28988c0 100644
--- a/test/basic.js
+++ b/test/basic.js
@@ -12,6 +12,10 @@ var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cf
test('client.add/remove: magnet uri, utf-8 string', function (t) {
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('magnet:?xt=urn:btih:' + leavesTorrent.infoHash)
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -26,6 +30,10 @@ test('client.add/remove: magnet uri, utf-8 string', function (t) {
test('client.add/remove: torrent file, buffer', function (t) {
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(leaves)
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -40,6 +48,10 @@ test('client.add/remove: torrent file, buffer', function (t) {
test('client.add/remove: info hash, hex string', function (t) {
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(leavesTorrent.infoHash)
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -54,6 +66,10 @@ test('client.add/remove: info hash, hex string', function (t) {
test('client.add/remove: info hash, buffer', function (t) {
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(new Buffer(leavesTorrent.infoHash, 'hex'))
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -68,6 +84,10 @@ test('client.add/remove: info hash, buffer', function (t) {
test('client.add/remove: parsed torrent, from `parse-torrent`', function (t) {
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(leavesTorrent)
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -82,6 +102,10 @@ test('client.add/remove: parsed torrent, from `parse-torrent`', function (t) {
test('client.add/remove: parsed torrent, with string type announce property', function (t) {
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 modifiedParsedTorrent = extend(leavesTorrent, {
announce: leavesTorrent.announce[0]
})
@@ -98,6 +122,10 @@ test('client.add/remove: parsed torrent, with string type announce property', fu
test('client.remove: remove by Torrent object', function (t) {
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(leavesTorrent.infoHash)
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -111,6 +139,10 @@ test('client.remove: remove by Torrent object', function (t) {
test('torrent.destroy: destroy and remove torrent', function (t) {
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(leavesTorrent.infoHash)
t.equal(client.torrents.length, 1)
torrent.on('infoHash', function () {
@@ -138,6 +170,10 @@ test('client.seed: torrent file (Buffer)', function (t) {
}
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.seed(leavesBook, opts, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, leavesTorrent.infoHash)
@@ -164,6 +200,10 @@ test('client.seed: torrent file (Blob)', function (t) {
if (global.Blob !== undefined) {
t.plan(4)
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.seed(new global.Blob([ leavesBook ]), opts, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, leavesTorrent.infoHash)
@@ -182,6 +222,10 @@ test('after client.destroy(), throw on client.add() or client.seed()', function
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) })
+
client.destroy(function () {
t.pass('client destroyed')
})
@@ -197,6 +241,10 @@ test('after client.destroy(), no "torrent" or "ready" events emitted', function
t.plan(1)
var client = new WebTorrent({ dht: false, tracker: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.add(leaves, { name: 'leaves' }, function () {
t.fail('unexpected "torrent" event (from add)')
})
diff --git a/test/blocklist-dht.js b/test/blocklist-dht.js
index 9b4cb47..3e8710b 100644
--- a/test/blocklist-dht.js
+++ b/test/blocklist-dht.js
@@ -17,9 +17,8 @@ test('blocklist blocks peers discovered via DHT', function (t) {
var dhtServer = new DHT({ bootstrap: false })
- dhtServer.on('error', function (err) {
- t.fail(err)
- })
+ dhtServer.on('error', function (err) { t.fail(err) })
+ dhtServer.on('warning', function (err) { t.fail(err) })
auto({
dhtPort: function (cb) {
@@ -35,6 +34,7 @@ test('blocklist blocks peers discovered via DHT', function (t) {
dht: { bootstrap: '127.0.0.1:' + r.dhtPort }
})
client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
var torrent1 = client1.add(leavesParsed)
@@ -61,6 +61,7 @@ test('blocklist blocks peers discovered via DHT', function (t) {
blocklist: [ '127.0.0.1', networkAddress.ipv4() ]
})
client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
var torrent2 = client2.add(leavesParsed)
diff --git a/test/blocklist-tracker.js b/test/blocklist-tracker.js
index 30d22a9..e34b16a 100644
--- a/test/blocklist-tracker.js
+++ b/test/blocklist-tracker.js
@@ -33,6 +33,7 @@ test('blocklist blocks peers discovered via tracker', function (t) {
client1: ['tracker', function (cb) {
var client1 = new WebTorrent({ dht: false })
client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
var torrent1 = client1.add(leavesParsed)
@@ -52,6 +53,7 @@ test('blocklist blocks peers discovered via tracker', function (t) {
blocklist: [ '127.0.0.1' ]
})
client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
var torrent2 = client2.add(leavesParsed)
diff --git a/test/blocklist.js b/test/blocklist.js
index bc03432..dd35fa0 100644
--- a/test/blocklist.js
+++ b/test/blocklist.js
@@ -37,6 +37,7 @@ test('blocklist (single IP)', function (t) {
blocklist: [ '1.2.3.4' ]
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertBlocked(t, torrent, '1.2.3.4:1234')
@@ -58,6 +59,7 @@ test('blocklist (array of IPs)', function (t) {
blocklist: [ '1.2.3.4', '5.6.7.8' ]
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertBlocked(t, torrent, '1.2.3.4:1234')
@@ -122,6 +124,7 @@ test('blocklist (array of IP ranges)', function (t) {
]
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertList(t, torrent)
@@ -148,6 +151,7 @@ test('blocklist (http url)', function (t) {
blocklist: url
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertList(t, torrent)
@@ -179,6 +183,7 @@ test('blocklist (http url with gzip encoding)', function (t) {
blocklist: url
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertList(t, torrent)
@@ -210,6 +215,7 @@ test('blocklist (http url with deflate encoding)', function (t) {
blocklist: url
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertList(t, torrent)
@@ -228,6 +234,7 @@ test('blocklist (fs path)', function (t) {
blocklist: blocklistPath
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertList(t, torrent)
@@ -244,6 +251,7 @@ test('blocklist (fs path with gzip)', function (t) {
blocklist: blocklistGzipPath
})
.on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
.on('ready', function () {
client.add(leavesParsed, function (torrent) {
assertList(t, torrent)
diff --git a/test/cmd.js b/test/cmd.js
index 60944bf..c937a6b 100644
--- a/test/cmd.js
+++ b/test/cmd.js
@@ -83,9 +83,7 @@ test('Command line: webtorrent create /path/to/file', function (t) {
var leavesPath = __dirname + '/content/Leaves of Grass by Walt Whitman.epub'
var child = cp.spawn(CMD, [ 'create', leavesPath ])
- child.on('error', function (err) {
- throw err
- })
+ child.on('error', function (err) { t.fail(err) })
var chunks = []
child.stdout.on('data', function (chunk) {
diff --git a/test/download-dht-magnet.js b/test/download-dht-magnet.js
index ad07bab..3c05b30 100644
--- a/test/download-dht-magnet.js
+++ b/test/download-dht-magnet.js
@@ -17,9 +17,8 @@ test('Download using DHT (via magnet uri)', function (t) {
t.plan(10)
var dhtServer = new DHT({ bootstrap: false })
- dhtServer.on('error', function (err) {
- t.fail(err)
- })
+ dhtServer.on('error', function (err) { t.fail(err) })
+ dhtServer.on('warning', function (err) { t.fail(err) })
var magnetUri = 'magnet:?xt=urn:btih:' + leavesParsed.infoHash
@@ -36,6 +35,7 @@ test('Download using DHT (via magnet uri)', function (t) {
dht: { bootstrap: '127.0.0.1:' + r.dhtPort }
})
client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
var announced = false
var wroteStorage = false
@@ -69,6 +69,7 @@ test('Download using DHT (via magnet uri)', function (t) {
dht: { bootstrap: '127.0.0.1:' + r.dhtPort }
})
client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
var gotBuffer = false
var gotDone = false
diff --git a/test/download-dht-torrent.js b/test/download-dht-torrent.js
index ed76d65..63f90bd 100644
--- a/test/download-dht-torrent.js
+++ b/test/download-dht-torrent.js
@@ -18,9 +18,8 @@ test('Download using DHT (via .torrent file)', function (t) {
var dhtServer = new DHT({ bootstrap: false })
- dhtServer.on('error', function (err) {
- t.fail(err)
- })
+ dhtServer.on('error', function (err) { t.fail(err) })
+ dhtServer.on('warning', function (err) { t.fail(err) })
auto({
dhtPort: function (cb) {
@@ -35,6 +34,7 @@ test('Download using DHT (via .torrent file)', function (t) {
dht: { bootstrap: '127.0.0.1:' + r.dhtPort }
})
client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
client1.add(leavesParsed)
@@ -68,6 +68,7 @@ test('Download using DHT (via .torrent file)', function (t) {
dht: { bootstrap: '127.0.0.1:' + r.dhtPort }
})
client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
client2.add(leavesParsed)
diff --git a/test/download-tracker-magnet.js b/test/download-tracker-magnet.js
index 843a3d6..079c162 100644
--- a/test/download-tracker-magnet.js
+++ b/test/download-tracker-magnet.js
@@ -30,9 +30,8 @@ function magnetDownloadTest (t, serverType) {
serverType === 'udp' ? { http: false } : { udp: false }
)
- tracker.on('error', function (err) {
- t.fail(err)
- })
+ tracker.on('error', function (err) { t.fail(err) })
+ tracker.on('warning', function (err) { t.fail(err) })
tracker.on('start', function () {
trackerStartCount += 1
@@ -53,6 +52,7 @@ function magnetDownloadTest (t, serverType) {
client1: ['tracker', function (cb) {
var client1 = new WebTorrent({ dht: false })
client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
client1.add(leavesParsed)
@@ -75,6 +75,7 @@ function magnetDownloadTest (t, serverType) {
client2: ['client1', function (cb) {
var client2 = new WebTorrent({ dht: false })
client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
client2.add(magnetUri)
diff --git a/test/download-tracker-torrent.js b/test/download-tracker-torrent.js
index 415c112..3c9a8be 100644
--- a/test/download-tracker-torrent.js
+++ b/test/download-tracker-torrent.js
@@ -29,9 +29,8 @@ function torrentDownloadTest (t, serverType) {
serverType === 'udp' ? { http: false } : { udp: false }
)
- tracker.on('error', function (err) {
- t.fail(err)
- })
+ tracker.on('error', function (err) { t.fail(err) })
+ tracker.on('warning', function (err) { t.fail(err) })
tracker.on('start', function () {
trackerStartCount += 1
@@ -53,6 +52,7 @@ function torrentDownloadTest (t, serverType) {
client1: ['tracker', function (cb) {
var client1 = new WebTorrent({ dht: false })
client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
client1.add(leavesParsed)
@@ -75,6 +75,7 @@ function torrentDownloadTest (t, serverType) {
client2: ['client1', function (cb) {
var client2 = new WebTorrent({ dht: false })
client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
client2.add(leavesParsed)
diff --git a/test/download-webseed-magnet.js b/test/download-webseed-magnet.js
index a2627b8..214a92b 100644
--- a/test/download-webseed-magnet.js
+++ b/test/download-webseed-magnet.js
@@ -27,9 +27,7 @@ test('Download using webseed (via magnet uri)', function (t) {
})
var magnetUri
- httpServer.on('error', function (err) {
- t.fail(err)
- })
+ httpServer.on('error', function (err) { t.fail(err) })
auto({
httpPort: function (cb) {
diff --git a/test/duplicates.js b/test/duplicates.js
index f1585a8..c033d2a 100644
--- a/test/duplicates.js
+++ b/test/duplicates.js
@@ -12,6 +12,9 @@ test('client.seed followed by duplicate client.add', function (t) {
}
var client = new WebTorrent({ dht: false, tracker: false })
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
client.seed(leavesBook, opts, function (torrent1) {
client.add(torrent1.infoHash, function (torrent2) {
t.equal(torrent1.infoHash, torrent2.infoHash)
@@ -31,6 +34,8 @@ test('client.seed followed by duplicate client.add, twice', function (t) {
}
var client = new WebTorrent({ dht: false, tracker: false })
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
client.seed(leavesBook, opts, function (torrent1) {
client.add(torrent1.infoHash, function (torrent2) {
diff --git a/test/extensions.js b/test/extensions.js
index ade5b9d..ba5e204 100644
--- a/test/extensions.js
+++ b/test/extensions.js
@@ -34,8 +34,15 @@ test('extension support', function (t) {
}
var client1 = new WebTorrent({ dht: false, tracker: false })
+
+ client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
+
var client2 = new WebTorrent({ dht: false, tracker: false })
+ client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
+
client1.add(leavesTorrent, function (torrent1) {
torrent1.on('wire', function (wire) {
t.pass('client1 onWire')
diff --git a/test/metadata.js b/test/metadata.js
index e812c3f..cf386aa 100644
--- a/test/metadata.js
+++ b/test/metadata.js
@@ -10,8 +10,15 @@ test('ut_metadata transfer', function (t) {
t.plan(6)
var client1 = new WebTorrent({ dht: false, tracker: false })
+
+ client1.on('error', function (err) { t.fail(err) })
+ client1.on('warning', function (err) { t.fail(err) })
+
var client2 = new WebTorrent({ dht: false, tracker: false })
+ client2.on('error', function (err) { t.fail(err) })
+ client2.on('warning', function (err) { t.fail(err) })
+
client1.on('torrent', function (torrent) {
t.pass('client1 emits torrent event') // even though it started with metadata
t.ok(torrent.metadata, 'metadata exists')
@@ -20,9 +27,6 @@ test('ut_metadata transfer', function (t) {
// client1 starts with metadata from torrent file
client1.add(leaves)
- client1.on('error', function (err) { t.fail(err) })
- client2.on('error', function (err) { t.fail(err) })
-
client1.on('torrent', function (torrent1) {
t.deepEqual(torrent1.parsedTorrent.info, leavesTorrent.info)
diff --git a/test/server.js b/test/server.js
index 823668a..920637a 100644
--- a/test/server.js
+++ b/test/server.js
@@ -7,7 +7,11 @@ var leavesPath = __dirname + '/content/Leaves of Grass by Walt Whitman.epub'
var leavesTorrent = fs.readFileSync(__dirname + '/torrents/leaves.torrent')
test('start http server programmatically', function (t) {
- var client = new WebTorrent()
+ var client = new WebTorrent({ tracker: false, dht: false })
+
+ client.on('error', function (err) { t.fail(err) })
+ client.on('warning', function (err) { t.fail(err) })
+
var torrent = client.add(leavesTorrent, { dht: false, tracker: false }, function (torrent) {
// create HTTP server for this torrent
var server = torrent.createServer()