From 32b622aa519c89da3666d01d7606440bcfbae5b3 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 26 Nov 2014 20:11:49 +0800 Subject: [PATCH] cleanup tests --- test/client-large-torrent.js | 4 ++-- test/client-magnet.js | 5 ++--- test/client.js | 4 ++-- test/scrape.js | 8 +++----- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/test/client-large-torrent.js b/test/client-large-torrent.js index f5556c2..5b3308b 100644 --- a/test/client-large-torrent.js +++ b/test/client-large-torrent.js @@ -43,8 +43,8 @@ test('large torrent: client.start()', function (t) { client.start() - client.once('peer', function (addr) { - t.pass('there is at least one peer') // TODO: this shouldn't rely on an external server! + client.once('peer', function () { + t.pass('there is at least one peer') client.stop() diff --git a/test/client-magnet.js b/test/client-magnet.js index aa4d25b..9c1ea54 100644 --- a/test/client-magnet.js +++ b/test/client-magnet.js @@ -1,5 +1,4 @@ var Client = require('../') -var fs = require('fs') var magnet = require('magnet-uri') var portfinder = require('portfinder') var Server = require('../').Server @@ -44,8 +43,8 @@ test('magnet + udp: client.start/update/stop()', function (t) { client.start() - client.once('peer', function (addr) { - t.pass('there is at least one peer') // TODO: this shouldn't rely on an external server! + client.once('peer', function () { + t.pass('there is at least one peer') client.update() diff --git a/test/client.js b/test/client.js index ea022bf..fd0dbdb 100644 --- a/test/client.js +++ b/test/client.js @@ -31,7 +31,7 @@ function testClientStart (t, serverType) { t.equal(typeof data.incomplete, 'number') }) - client.once('peer', function (addr) { + client.once('peer', function () { t.pass('there is at least one peer') client.stop() @@ -186,7 +186,7 @@ function testClientAnnounceWithNumWant (t, serverType) { }) client1.start() - client1.once('update', function (data) { + client1.once('update', function () { var client2 = new Client(peerId2, port + 1, parsedTorrent) client2.on('error', function (err) { t.error(err) diff --git a/test/scrape.js b/test/scrape.js index 29b0f52..33d80ae 100644 --- a/test/scrape.js +++ b/test/scrape.js @@ -7,7 +7,6 @@ var fs = require('fs') var http = require('http') var parseTorrent = require('parse-torrent') var portfinder = require('portfinder') -var querystring = require('querystring') var Server = require('../').Server var test = require('tape') @@ -28,7 +27,6 @@ var peerId = new Buffer('01234567890123456789') function testSingle (t, serverType) { commonTest.createServer(t, serverType, function (server, announceUrl) { - var scrapeUrl = announceUrl.replace('announce', 'scrape') server.once('listening', function () { Client.scrape(announceUrl, infoHash1, function (err, data) { t.error(err) @@ -118,7 +116,7 @@ test('server: multiple info_hash scrape', function (t) { t.end() }) })) - }).on('error', function (e) { + }).on('error', function (err) { t.error(err) }) }) @@ -151,7 +149,7 @@ test('server: all info_hash scrape', function (t) { }) client.start() - server.once('start', function (data) { + server.once('start', function () { // now do a scrape of everything by omitting the info_hash param http.get(scrapeUrl, function (res) { @@ -172,7 +170,7 @@ test('server: all info_hash scrape', function (t) { t.end() }) })) - }).on('error', function (e) { + }).on('error', function (err) { t.error(err) }) })