Skip to content

Commit ae5e99f

Browse files
committed
Use object shorthand for properties
1 parent 938db35 commit ae5e99f

File tree

11 files changed

+46
-46
lines changed

11 files changed

+46
-46
lines changed

test/client-large-torrent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function testLargeTorrent (t, serverType) {
1111
common.createServer(t, serverType, function (server, announceUrl) {
1212
var client = new Client({
1313
infoHash: fixtures.sintel.parsedTorrent.infoHash,
14-
peerId: peerId,
14+
peerId,
1515
port: 6881,
1616
announce: announceUrl,
1717
wrtc: {}

test/client-magnet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function testMagnet (t, serverType) {
1515
var client = new Client({
1616
infoHash: parsedTorrent.infoHash,
1717
announce: announceUrl,
18-
peerId: peerId,
18+
peerId,
1919
port: 6881,
2020
wrtc: {}
2121
})

test/client-ws-socket-pool.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ test('ensure client.destroy() callback is called with re-used websockets in sock
1313
var client1 = new Client({
1414
infoHash: fixtures.leaves.parsedTorrent.infoHash,
1515
announce: announceUrl,
16-
peerId: peerId,
17-
port: port,
16+
peerId,
17+
port,
1818
wrtc: {}
1919
})
2020

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

test/client.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function testClientStart (t, serverType) {
1616
infoHash: fixtures.leaves.parsedTorrent.infoHash,
1717
announce: announceUrl,
1818
peerId: peerId1,
19-
port: port,
19+
port,
2020
wrtc: {}
2121
})
2222

@@ -62,7 +62,7 @@ function testClientStop (t, serverType) {
6262
infoHash: fixtures.leaves.parsedTorrent.infoHash,
6363
announce: announceUrl,
6464
peerId: peerId1,
65-
port: port,
65+
port,
6666
wrtc: {}
6767
})
6868

@@ -110,7 +110,7 @@ function testClientStopDestroy (t, serverType) {
110110
infoHash: fixtures.leaves.parsedTorrent.infoHash,
111111
announce: announceUrl,
112112
peerId: peerId1,
113-
port: port,
113+
port,
114114
wrtc: {}
115115
})
116116

@@ -164,7 +164,7 @@ function testClientUpdate (t, serverType) {
164164
infoHash: fixtures.leaves.parsedTorrent.infoHash,
165165
announce: announceUrl,
166166
peerId: peerId1,
167-
port: port,
167+
port,
168168
wrtc: {}
169169
})
170170

@@ -217,7 +217,7 @@ function testClientScrape (t, serverType) {
217217
infoHash: fixtures.leaves.parsedTorrent.infoHash,
218218
announce: announceUrl,
219219
peerId: peerId1,
220-
port: port,
220+
port,
221221
wrtc: {}
222222
})
223223

@@ -259,7 +259,7 @@ function testClientAnnounceWithParams (t, serverType) {
259259
infoHash: fixtures.leaves.parsedTorrent.infoHash,
260260
announce: announceUrl,
261261
peerId: peerId1,
262-
port: port,
262+
port,
263263
wrtc: {}
264264
})
265265

@@ -307,7 +307,7 @@ function testClientGetAnnounceOpts (t, serverType) {
307307
infoHash: fixtures.leaves.parsedTorrent.infoHash,
308308
announce: announceUrl,
309309
peerId: peerId1,
310-
port: port,
310+
port,
311311
getAnnounceOpts: function () {
312312
return {
313313
testParam: 'this is a test'
@@ -358,7 +358,7 @@ function testClientAnnounceWithNumWant (t, serverType) {
358358
infoHash: fixtures.leaves.parsedTorrent.infoHash,
359359
announce: [announceUrl],
360360
peerId: peerId1,
361-
port: port,
361+
port,
362362
wrtc: {}
363363
})
364364

@@ -449,7 +449,7 @@ test('http: userAgent', function (t) {
449449
infoHash: fixtures.leaves.parsedTorrent.infoHash,
450450
announce: announceUrl,
451451
peerId: peerId1,
452-
port: port,
452+
port,
453453
userAgent: 'WebTorrent/0.98.0 (https://webtorrent.io)',
454454
wrtc: {}
455455
})
@@ -476,7 +476,7 @@ function testSupportedTracker (t, serverType) {
476476
infoHash: fixtures.leaves.parsedTorrent.infoHash,
477477
announce: announceUrl,
478478
peerId: peerId1,
479-
port: port,
479+
port,
480480
wrtc: {}
481481
})
482482

@@ -514,7 +514,7 @@ function testUnsupportedTracker (t, announceUrl) {
514514
infoHash: fixtures.leaves.parsedTorrent.infoHash,
515515
announce: announceUrl,
516516
peerId: peerId1,
517-
port: port,
517+
port,
518518
wrtc: {}
519519
})
520520

test/destroy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ function testNoEventsAfterDestroy (t, serverType) {
1313
var client = new Client({
1414
infoHash: fixtures.leaves.parsedTorrent.infoHash,
1515
announce: announceUrl,
16-
peerId: peerId,
17-
port: port,
16+
peerId,
17+
port,
1818
wrtc: {}
1919
})
2020

test/evict.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function serverTest (t, serverType, serverFamily) {
1616
: '127.0.0.1'
1717

1818
var opts = {
19-
serverType: serverType,
19+
serverType,
2020
peersCacheLength: 2 // LRU cache can only contain a max of 2 peers
2121
}
2222

@@ -27,23 +27,23 @@ function serverTest (t, serverType, serverFamily) {
2727
var announceUrl = serverType + '://' + hostname + ':' + port + '/announce'
2828

2929
var client1 = new Client({
30-
infoHash: infoHash,
30+
infoHash,
3131
announce: [announceUrl],
32-
peerId: peerId,
32+
peerId,
3333
port: 6881,
34-
wrtc: wrtc
34+
wrtc
3535
})
3636
if (serverType === 'ws') common.mockWebsocketTracker(client1)
3737

3838
client1.start()
3939

4040
client1.once('update', function (data) {
4141
var client2 = new Client({
42-
infoHash: infoHash,
42+
infoHash,
4343
announce: [announceUrl],
4444
peerId: peerId2,
4545
port: 6882,
46-
wrtc: wrtc
46+
wrtc
4747
})
4848
if (serverType === 'ws') common.mockWebsocketTracker(client2)
4949

@@ -64,11 +64,11 @@ function serverTest (t, serverType, serverFamily) {
6464
})
6565

6666
var client3 = new Client({
67-
infoHash: infoHash,
67+
infoHash,
6868
announce: [announceUrl],
6969
peerId: peerId3,
7070
port: 6880,
71-
wrtc: wrtc
71+
wrtc
7272
})
7373
if (serverType === 'ws') common.mockWebsocketTracker(client3)
7474

test/filter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var peerId = Buffer.from('01234567890123456789')
88
function testFilterOption (t, serverType) {
99
t.plan(8)
1010

11-
var opts = { serverType: serverType } // this is test-suite-only option
11+
var opts = { serverType } // this is test-suite-only option
1212
opts.filter = function (infoHash, params, cb) {
1313
process.nextTick(function () {
1414
if (infoHash === fixtures.alice.parsedTorrent.infoHash) {
@@ -23,7 +23,7 @@ function testFilterOption (t, serverType) {
2323
var client1 = new Client({
2424
infoHash: fixtures.alice.parsedTorrent.infoHash,
2525
announce: announceUrl,
26-
peerId: peerId,
26+
peerId,
2727
port: 6881,
2828
wrtc: {}
2929
})
@@ -40,7 +40,7 @@ function testFilterOption (t, serverType) {
4040
var client2 = new Client({
4141
infoHash: fixtures.leaves.parsedTorrent.infoHash,
4242
announce: announceUrl,
43-
peerId: peerId,
43+
peerId,
4444
port: 6881,
4545
wrtc: {}
4646
})
@@ -88,7 +88,7 @@ test('ws: filter option blocks tracker from tracking torrent', function (t) {
8888
function testFilterCustomError (t, serverType) {
8989
t.plan(8)
9090

91-
var opts = { serverType: serverType } // this is test-suite-only option
91+
var opts = { serverType } // this is test-suite-only option
9292
opts.filter = function (infoHash, params, cb) {
9393
process.nextTick(function () {
9494
if (infoHash === fixtures.alice.parsedTorrent.infoHash) {
@@ -103,7 +103,7 @@ function testFilterCustomError (t, serverType) {
103103
var client1 = new Client({
104104
infoHash: fixtures.alice.parsedTorrent.infoHash,
105105
announce: announceUrl,
106-
peerId: peerId,
106+
peerId,
107107
port: 6881,
108108
wrtc: {}
109109
})
@@ -119,7 +119,7 @@ function testFilterCustomError (t, serverType) {
119119
var client2 = new Client({
120120
infoHash: fixtures.leaves.parsedTorrent.infoHash,
121121
announce: announceUrl,
122-
peerId: peerId,
122+
peerId,
123123
port: 6881,
124124
wrtc: {}
125125
})

test/request-handler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var peerId = Buffer.from('01234567890123456789')
99
function testRequestHandler (t, serverType) {
1010
t.plan(5)
1111

12-
var opts = { serverType: serverType } // this is test-suite-only option
12+
var opts = { serverType } // this is test-suite-only option
1313

1414
class Swarm extends Server.Swarm {
1515
announce (params, cb) {
@@ -33,7 +33,7 @@ function testRequestHandler (t, serverType) {
3333
var client1 = new Client({
3434
infoHash: fixtures.alice.parsedTorrent.infoHash,
3535
announce: announceUrl,
36-
peerId: peerId,
36+
peerId,
3737
port: 6881,
3838
wrtc: {}
3939
})

test/scrape.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function testSingle (t, serverType) {
1414
var client = new Client({
1515
infoHash: fixtures.leaves.parsedTorrent.infoHash,
1616
announce: announceUrl,
17-
peerId: peerId,
17+
peerId,
1818
port: 6881,
1919
wrtc: {}
2020
})
@@ -199,7 +199,7 @@ test('server: all info_hash scrape (manual http request)', function (t) {
199199
var client = new Client({
200200
infoHash: fixtures.leaves.parsedTorrent.infoHash,
201201
announce: announceUrl,
202-
peerId: peerId,
202+
peerId,
203203
port: 6881
204204
})
205205
client.on('error', function (err) { t.error(err) })

test/server.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function serverTest (t, serverType, serverFamily) {
1919
: '127.0.0.1'
2020

2121
var opts = {
22-
serverType: serverType
22+
serverType
2323
}
2424

2525
common.createServer(t, opts, function (server) {
@@ -29,11 +29,11 @@ function serverTest (t, serverType, serverFamily) {
2929
var announceUrl = serverType + '://' + hostname + ':' + port + '/announce'
3030

3131
var client1 = new Client({
32-
infoHash: infoHash,
32+
infoHash,
3333
announce: [announceUrl],
34-
peerId: peerId,
34+
peerId,
3535
port: 6881,
36-
wrtc: wrtc
36+
wrtc
3737
})
3838
if (serverType === 'ws') common.mockWebsocketTracker(client1)
3939

@@ -89,11 +89,11 @@ function serverTest (t, serverType, serverFamily) {
8989
t.equal(typeof data.downloaded, 'number')
9090

9191
var client2 = new Client({
92-
infoHash: infoHash,
92+
infoHash,
9393
announce: [announceUrl],
9494
peerId: peerId2,
9595
port: 6882,
96-
wrtc: wrtc
96+
wrtc
9797
})
9898
if (serverType === 'ws') common.mockWebsocketTracker(client2)
9999

@@ -109,11 +109,11 @@ function serverTest (t, serverType, serverFamily) {
109109
t.equal(data.incomplete, 1)
110110

111111
var client3 = new Client({
112-
infoHash: infoHash,
112+
infoHash,
113113
announce: [announceUrl],
114114
peerId: peerId3,
115115
port: 6880,
116-
wrtc: wrtc
116+
wrtc
117117
})
118118
if (serverType === 'ws') common.mockWebsocketTracker(client3)
119119

0 commit comments

Comments
 (0)