Merge pull request #341 from LinusU/object-shorthand

This commit is contained in:
Feross Aboukhadijeh 2020-05-17 12:37:05 -07:00 committed by GitHub
commit 04dd528c27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 46 additions and 46 deletions

View File

@ -11,7 +11,7 @@ function testLargeTorrent (t, serverType) {
common.createServer(t, serverType, function (server, announceUrl) {
var client = new Client({
infoHash: fixtures.sintel.parsedTorrent.infoHash,
peerId: peerId,
peerId,
port: 6881,
announce: announceUrl,
wrtc: {}

View File

@ -15,7 +15,7 @@ function testMagnet (t, serverType) {
var client = new Client({
infoHash: parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})

View File

@ -13,8 +13,8 @@ test('ensure client.destroy() callback is called with re-used websockets in sock
var client1 = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
port: port,
peerId,
port,
wrtc: {}
})
@ -30,8 +30,8 @@ test('ensure client.destroy() callback is called with re-used websockets in sock
var client2 = new Client({
infoHash: fixtures.alice.parsedTorrent.infoHash, // different info hash
announce: announceUrl,
peerId: peerId,
port: port,
peerId,
port,
wrtc: {}
})

View File

@ -16,7 +16,7 @@ function testClientStart (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -62,7 +62,7 @@ function testClientStop (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -110,7 +110,7 @@ function testClientStopDestroy (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -164,7 +164,7 @@ function testClientUpdate (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -217,7 +217,7 @@ function testClientScrape (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -259,7 +259,7 @@ function testClientAnnounceWithParams (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -307,7 +307,7 @@ function testClientGetAnnounceOpts (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
getAnnounceOpts: function () {
return {
testParam: 'this is a test'
@ -358,7 +358,7 @@ function testClientAnnounceWithNumWant (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: [announceUrl],
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -449,7 +449,7 @@ test('http: userAgent', function (t) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
userAgent: 'WebTorrent/0.98.0 (https://webtorrent.io)',
wrtc: {}
})
@ -476,7 +476,7 @@ function testSupportedTracker (t, serverType) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})
@ -514,7 +514,7 @@ function testUnsupportedTracker (t, announceUrl) {
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId1,
port: port,
port,
wrtc: {}
})

View File

@ -13,8 +13,8 @@ function testNoEventsAfterDestroy (t, serverType) {
var client = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
port: port,
peerId,
port,
wrtc: {}
})

View File

@ -16,7 +16,7 @@ function serverTest (t, serverType, serverFamily) {
: '127.0.0.1'
var opts = {
serverType: serverType,
serverType,
peersCacheLength: 2 // LRU cache can only contain a max of 2 peers
}
@ -27,11 +27,11 @@ function serverTest (t, serverType, serverFamily) {
var announceUrl = serverType + '://' + hostname + ':' + port + '/announce'
var client1 = new Client({
infoHash: infoHash,
infoHash,
announce: [announceUrl],
peerId: peerId,
peerId,
port: 6881,
wrtc: wrtc
wrtc
})
if (serverType === 'ws') common.mockWebsocketTracker(client1)
@ -39,11 +39,11 @@ function serverTest (t, serverType, serverFamily) {
client1.once('update', function (data) {
var client2 = new Client({
infoHash: infoHash,
infoHash,
announce: [announceUrl],
peerId: peerId2,
port: 6882,
wrtc: wrtc
wrtc
})
if (serverType === 'ws') common.mockWebsocketTracker(client2)
@ -64,11 +64,11 @@ function serverTest (t, serverType, serverFamily) {
})
var client3 = new Client({
infoHash: infoHash,
infoHash,
announce: [announceUrl],
peerId: peerId3,
port: 6880,
wrtc: wrtc
wrtc
})
if (serverType === 'ws') common.mockWebsocketTracker(client3)

View File

@ -8,7 +8,7 @@ var peerId = Buffer.from('01234567890123456789')
function testFilterOption (t, serverType) {
t.plan(8)
var opts = { serverType: serverType } // this is test-suite-only option
var opts = { serverType } // this is test-suite-only option
opts.filter = function (infoHash, params, cb) {
process.nextTick(function () {
if (infoHash === fixtures.alice.parsedTorrent.infoHash) {
@ -23,7 +23,7 @@ function testFilterOption (t, serverType) {
var client1 = new Client({
infoHash: fixtures.alice.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})
@ -40,7 +40,7 @@ function testFilterOption (t, serverType) {
var client2 = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})
@ -88,7 +88,7 @@ test('ws: filter option blocks tracker from tracking torrent', function (t) {
function testFilterCustomError (t, serverType) {
t.plan(8)
var opts = { serverType: serverType } // this is test-suite-only option
var opts = { serverType } // this is test-suite-only option
opts.filter = function (infoHash, params, cb) {
process.nextTick(function () {
if (infoHash === fixtures.alice.parsedTorrent.infoHash) {
@ -103,7 +103,7 @@ function testFilterCustomError (t, serverType) {
var client1 = new Client({
infoHash: fixtures.alice.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})
@ -119,7 +119,7 @@ function testFilterCustomError (t, serverType) {
var client2 = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})

View File

@ -9,7 +9,7 @@ var peerId = Buffer.from('01234567890123456789')
function testRequestHandler (t, serverType) {
t.plan(5)
var opts = { serverType: serverType } // this is test-suite-only option
var opts = { serverType } // this is test-suite-only option
class Swarm extends Server.Swarm {
announce (params, cb) {
@ -33,7 +33,7 @@ function testRequestHandler (t, serverType) {
var client1 = new Client({
infoHash: fixtures.alice.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})

View File

@ -14,7 +14,7 @@ function testSingle (t, serverType) {
var client = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881,
wrtc: {}
})
@ -199,7 +199,7 @@ test('server: all info_hash scrape (manual http request)', function (t) {
var client = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881
})
client.on('error', function (err) { t.error(err) })

View File

@ -19,7 +19,7 @@ function serverTest (t, serverType, serverFamily) {
: '127.0.0.1'
var opts = {
serverType: serverType
serverType
}
common.createServer(t, opts, function (server) {
@ -29,11 +29,11 @@ function serverTest (t, serverType, serverFamily) {
var announceUrl = serverType + '://' + hostname + ':' + port + '/announce'
var client1 = new Client({
infoHash: infoHash,
infoHash,
announce: [announceUrl],
peerId: peerId,
peerId,
port: 6881,
wrtc: wrtc
wrtc
})
if (serverType === 'ws') common.mockWebsocketTracker(client1)
@ -89,11 +89,11 @@ function serverTest (t, serverType, serverFamily) {
t.equal(typeof data.downloaded, 'number')
var client2 = new Client({
infoHash: infoHash,
infoHash,
announce: [announceUrl],
peerId: peerId2,
port: 6882,
wrtc: wrtc
wrtc
})
if (serverType === 'ws') common.mockWebsocketTracker(client2)
@ -109,11 +109,11 @@ function serverTest (t, serverType, serverFamily) {
t.equal(data.incomplete, 1)
var client3 = new Client({
infoHash: infoHash,
infoHash,
announce: [announceUrl],
peerId: peerId3,
port: 6880,
wrtc: wrtc
wrtc
})
if (serverType === 'ws') common.mockWebsocketTracker(client3)

View File

@ -120,7 +120,7 @@ test('server: get leecher stats.json', function (t) {
var client = new Client({
infoHash: fixtures.leaves.parsedTorrent.infoHash,
announce: announceUrl,
peerId: peerId,
peerId,
port: 6881
})
client.on('error', function (err) { t.error(err) })