diff options
Diffstat (limited to 'test/download-webseed-torrent.js')
-rw-r--r-- | test/download-webseed-torrent.js | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/test/download-webseed-torrent.js b/test/download-webseed-torrent.js index 5c048f8..b6f7b2c 100644 --- a/test/download-webseed-torrent.js +++ b/test/download-webseed-torrent.js @@ -21,7 +21,7 @@ leavesParsed.announce = [] test('Download using webseed (via .torrent file)', function (t) { t.plan(5) - var serve = serveStatic(path.join(__dirname, './content')) + var serve = serveStatic(path.join(__dirname, 'content')) var httpServer = http.createServer(function (req, res) { var done = finalhandler(req, res) serve(req, res, done) @@ -38,18 +38,15 @@ test('Download using webseed (via .torrent file)', function (t) { cb(null, port) }) }, - client1: ['httpPort', function (cb, r) { - + client: ['httpPort', function (cb, r) { leavesParsed.urlList.push('http://localhost:' + r.httpPort + '/' + leavesFilename) - var client1 = new WebTorrent({ - tracker: false, - dht: { bootstrap: false } - }) + var client = new WebTorrent({ tracker: false, dht: false }) - client1.on('error', function (err) { t.fail(err) }) + client.on('error', function (err) { t.fail(err) }) + client.on('warning', function (err) { t.fail(err) }) - client1.on('torrent', function (torrent) { + client.on('torrent', function (torrent) { torrent.files.forEach(function (file) { file.getBuffer(function (err, buf) { if (err) throw err @@ -58,18 +55,18 @@ test('Download using webseed (via .torrent file)', function (t) { }) torrent.once('done', function () { - t.pass('client1 downloaded torrent from webseed') - cb(null, client1) + t.pass('client downloaded torrent from webseed') + cb(null, client) }) }) - client1.add(leavesParsed) - + client.add(leavesParsed) }] }, function (err, r) { + t.error(err) - r.client1.destroy(function () { - t.pass('client1 destroyed') + r.client.destroy(function () { + t.pass('client destroyed') }) httpServer.close(function () { t.pass('http server closed') |