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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-07-27 03:14:58 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-07-27 03:14:58 +0300
commitd991ef4eda4feac8870079652042b6a9a1bfc084 (patch)
tree6161e6ae80b729fcd1eb3523af4b596774b1df7c
parent66ab7d24251a9c2816beca2fc17d9a1785427a49 (diff)
test cleanup
-rw-r--r--test/download-webseed-torrent.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/download-webseed-torrent.js b/test/download-webseed-torrent.js
index b6f7b2c..4e5d279 100644
--- a/test/download-webseed-torrent.js
+++ b/test/download-webseed-torrent.js
@@ -19,7 +19,7 @@ var leavesParsed = parseTorrent(leavesTorrent)
leavesParsed.announce = []
test('Download using webseed (via .torrent file)', function (t) {
- t.plan(5)
+ t.plan(6)
var serve = serveStatic(path.join(__dirname, 'content'))
var httpServer = http.createServer(function (req, res) {
@@ -27,19 +27,16 @@ test('Download using webseed (via .torrent file)', function (t) {
serve(req, res, done)
})
- httpServer.on('error', function (err) {
- t.fail(err)
- })
+ httpServer.on('error', function (err) { t.fail(err) })
auto({
httpPort: function (cb) {
- httpServer.listen(function () {
- var port = httpServer.address().port
- cb(null, port)
- })
+ httpServer.listen(cb)
},
- client: ['httpPort', function (cb, r) {
- leavesParsed.urlList.push('http://localhost:' + r.httpPort + '/' + leavesFilename)
+ client: ['httpPort', function (cb) {
+ leavesParsed.urlList.push(
+ 'http://localhost:' + httpServer.address().port + '/' + leavesFilename
+ )
var client = new WebTorrent({ tracker: false, dht: false })
@@ -49,7 +46,7 @@ test('Download using webseed (via .torrent file)', function (t) {
client.on('torrent', function (torrent) {
torrent.files.forEach(function (file) {
file.getBuffer(function (err, buf) {
- if (err) throw err
+ t.error(err)
t.deepEqual(buf, leavesFile, 'downloaded correct content')
})
})
@@ -63,7 +60,6 @@ test('Download using webseed (via .torrent file)', function (t) {
client.add(leavesParsed)
}]
}, function (err, r) {
-
t.error(err)
r.client.destroy(function () {
t.pass('client destroyed')