Skip to content

Commit a40032c

Browse files
committed
Use object shorthand for properties
1 parent dd9e6d3 commit a40032c

File tree

7 files changed

+79
-79
lines changed

7 files changed

+79
-79
lines changed

test/basic.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test('can detect error when RTCPeerConstructor throws', function (t) {
4343
test('signal event gets emitted', function (t) {
4444
t.plan(2)
4545

46-
var peer = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
46+
var peer = new Peer({ config, initiator: true, wrtc: common.wrtc })
4747
peer.once('signal', function () {
4848
t.pass('got signal event')
4949
peer.on('close', function () { t.pass('peer destroyed') })
@@ -52,7 +52,7 @@ test('signal event gets emitted', function (t) {
5252
})
5353

5454
test('signal event does not get emitted by non-initiator', function (t) {
55-
var peer = new Peer({ config: config, initiator: false, wrtc: common.wrtc })
55+
var peer = new Peer({ config, initiator: false, wrtc: common.wrtc })
5656
peer.once('signal', function () {
5757
t.fail('got signal event')
5858
peer.on('close', function () { t.pass('peer destroyed') })
@@ -67,7 +67,7 @@ test('signal event does not get emitted by non-initiator', function (t) {
6767

6868
test('signal event does not get emitted by non-initiator with stream', function (t) {
6969
var peer = new Peer({
70-
config: config,
70+
config,
7171
stream: common.getMediaStream(),
7272
initiator: false,
7373
wrtc: common.wrtc
@@ -87,8 +87,8 @@ test('signal event does not get emitted by non-initiator with stream', function
8787
test('data send/receive text', function (t) {
8888
t.plan(10)
8989

90-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
91-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
90+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
91+
var peer2 = new Peer({ config, wrtc: common.wrtc })
9292

9393
var numSignal1 = 0
9494
peer1.on('signal', function (data) {
@@ -135,8 +135,8 @@ test('data send/receive text', function (t) {
135135
test('sdpTransform function is called', function (t) {
136136
t.plan(3)
137137

138-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
139-
var peer2 = new Peer({ config: config, sdpTransform: sdpTransform, wrtc: common.wrtc })
138+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
139+
var peer2 = new Peer({ config, sdpTransform, wrtc: common.wrtc })
140140

141141
function sdpTransform (sdp) {
142142
t.equal(typeof sdp, 'string', 'got a string as SDP')
@@ -168,8 +168,8 @@ test('old constraint formats are used', function (t) {
168168
}
169169
}
170170

171-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc, constraints: constraints })
172-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, constraints: constraints })
171+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc, constraints })
172+
var peer2 = new Peer({ config, wrtc: common.wrtc, constraints })
173173

174174
peer1.on('signal', function (data) {
175175
peer2.signal(data)
@@ -196,8 +196,8 @@ test('new constraint formats are used', function (t) {
196196
offerToReceiveVideo: true
197197
}
198198

199-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc, constraints: constraints })
200-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, constraints: constraints })
199+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc, constraints })
200+
var peer2 = new Peer({ config, wrtc: common.wrtc, constraints })
201201

202202
peer1.on('signal', function (data) {
203203
peer2.signal(data)
@@ -230,8 +230,8 @@ test('ensure remote address and port are available right after connection', func
230230

231231
t.plan(7)
232232

233-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
234-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
233+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
234+
var peer2 = new Peer({ config, wrtc: common.wrtc })
235235

236236
peer1.on('signal', function (data) {
237237
peer2.signal(data)

test/binary.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ test('get config', function (t) {
1414
test('data send/receive Buffer', function (t) {
1515
t.plan(6)
1616

17-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
18-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
17+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
18+
var peer2 = new Peer({ config, wrtc: common.wrtc })
1919
peer1.on('signal', function (data) {
2020
peer2.signal(data)
2121
})
@@ -50,8 +50,8 @@ test('data send/receive Buffer', function (t) {
5050
test('data send/receive Uint8Array', function (t) {
5151
t.plan(6)
5252

53-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
54-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
53+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
54+
var peer2 = new Peer({ config, wrtc: common.wrtc })
5555
peer1.on('signal', function (data) {
5656
peer2.signal(data)
5757
})
@@ -88,8 +88,8 @@ test('data send/receive Uint8Array', function (t) {
8888
test('data send/receive ArrayBuffer', function (t) {
8989
t.plan(6)
9090

91-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
92-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
91+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
92+
var peer2 = new Peer({ config, wrtc: common.wrtc })
9393
peer1.on('signal', function (data) {
9494
peer2.signal(data)
9595
})

test/multistream.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ test('multistream', function (t) {
2020
t.plan(20)
2121

2222
var peer1 = new Peer({
23-
config: config,
23+
config,
2424
initiator: true,
2525
wrtc: common.wrtc,
2626
streams: (new Array(10)).fill(null).map(function () { return common.getMediaStream() })
2727
})
2828
var peer2 = new Peer({
29-
config: config,
29+
config,
3030
wrtc: common.wrtc,
3131
streams: (new Array(10)).fill(null).map(function () { return common.getMediaStream() })
3232
})
@@ -63,13 +63,13 @@ test('multistream (track event)', function (t) {
6363
t.plan(20)
6464

6565
var peer1 = new Peer({
66-
config: config,
66+
config,
6767
initiator: true,
6868
wrtc: common.wrtc,
6969
streams: (new Array(5)).fill(null).map(function () { return common.getMediaStream() })
7070
})
7171
var peer2 = new Peer({
72-
config: config,
72+
config,
7373
wrtc: common.wrtc,
7474
streams: (new Array(5)).fill(null).map(function () { return common.getMediaStream() })
7575
})
@@ -106,13 +106,13 @@ test('multistream on non-initiator only', function (t) {
106106
t.plan(30)
107107

108108
var peer1 = new Peer({
109-
config: config,
109+
config,
110110
initiator: true,
111111
wrtc: common.wrtc,
112112
streams: []
113113
})
114114
var peer2 = new Peer({
115-
config: config,
115+
config,
116116
wrtc: common.wrtc,
117117
streams: (new Array(10)).fill(null).map(function () { return common.getMediaStream() })
118118
})
@@ -153,14 +153,14 @@ test('delayed stream on non-initiator', function (t) {
153153
t.plan(1)
154154

155155
var peer1 = new Peer({
156-
config: config,
156+
config,
157157
trickle: true,
158158
initiator: true,
159159
wrtc: common.wrtc,
160160
streams: [common.getMediaStream()]
161161
})
162162
var peer2 = new Peer({
163-
config: config,
163+
config,
164164
trickle: true,
165165
wrtc: common.wrtc,
166166
streams: []
@@ -191,13 +191,13 @@ test('incremental multistream', function (t) {
191191
t.plan(12)
192192

193193
var peer1 = new Peer({
194-
config: config,
194+
config,
195195
initiator: true,
196196
wrtc: common.wrtc,
197197
streams: []
198198
})
199199
var peer2 = new Peer({
200-
config: config,
200+
config,
201201
wrtc: common.wrtc,
202202
streams: []
203203
})
@@ -254,13 +254,13 @@ test('incremental multistream (track event)', function (t) {
254254
t.plan(22)
255255

256256
var peer1 = new Peer({
257-
config: config,
257+
config,
258258
initiator: true,
259259
wrtc: common.wrtc,
260260
streams: []
261261
})
262262
var peer2 = new Peer({
263-
config: config,
263+
config,
264264
wrtc: common.wrtc,
265265
streams: []
266266
})
@@ -322,13 +322,13 @@ test('incremental multistream on non-initiator only', function (t) {
322322
t.plan(7)
323323

324324
var peer1 = new Peer({
325-
config: config,
325+
config,
326326
initiator: true,
327327
wrtc: common.wrtc,
328328
streams: []
329329
})
330330
var peer2 = new Peer({
331-
config: config,
331+
config,
332332
wrtc: common.wrtc,
333333
streams: []
334334
})
@@ -370,13 +370,13 @@ test('incremental multistream on non-initiator only (track event)', function (t)
370370
t.plan(12)
371371

372372
var peer1 = new Peer({
373-
config: config,
373+
config,
374374
initiator: true,
375375
wrtc: common.wrtc,
376376
streams: []
377377
})
378378
var peer2 = new Peer({
379-
config: config,
379+
config,
380380
wrtc: common.wrtc,
381381
streams: []
382382
})
@@ -425,8 +425,8 @@ test('addStream after removeStream', function (t) {
425425
var stream1 = common.getMediaStream()
426426
var stream2 = common.getMediaStream()
427427

428-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
429-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, streams: [stream1] })
428+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
429+
var peer2 = new Peer({ config, wrtc: common.wrtc, streams: [stream1] })
430430

431431
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
432432
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })
@@ -451,8 +451,8 @@ test('addStream after removeStream', function (t) {
451451
test('removeTrack immediately', function (t) {
452452
t.plan(2)
453453

454-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
455-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
454+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
455+
var peer2 = new Peer({ config, wrtc: common.wrtc })
456456

457457
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
458458
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })
@@ -489,8 +489,8 @@ test('removeTrack immediately', function (t) {
489489
test('replaceTrack', function (t) {
490490
t.plan(4)
491491

492-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
493-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
492+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
493+
var peer2 = new Peer({ config, wrtc: common.wrtc })
494494

495495
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
496496
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })

test/negotiation.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ test('get config', function (t) {
1414
test('single negotiation', function (t) {
1515
t.plan(10)
1616

17-
var peer1 = new Peer({ config: config, initiator: true, stream: common.getMediaStream(), wrtc: common.wrtc })
18-
var peer2 = new Peer({ config: config, stream: common.getMediaStream(), wrtc: common.wrtc })
17+
var peer1 = new Peer({ config, initiator: true, stream: common.getMediaStream(), wrtc: common.wrtc })
18+
var peer2 = new Peer({ config, stream: common.getMediaStream(), wrtc: common.wrtc })
1919

2020
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
2121
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })
@@ -55,8 +55,8 @@ test('single negotiation', function (t) {
5555
test('manual renegotiation', function (t) {
5656
t.plan(2)
5757

58-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
59-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
58+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
59+
var peer2 = new Peer({ config, wrtc: common.wrtc })
6060

6161
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
6262
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })
@@ -76,8 +76,8 @@ test('manual renegotiation', function (t) {
7676
test('repeated manual renegotiation', function (t) {
7777
t.plan(6)
7878

79-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
80-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
79+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
80+
var peer2 = new Peer({ config, wrtc: common.wrtc })
8181

8282
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
8383
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })
@@ -117,8 +117,8 @@ test('renegotiation after addStream', function (t) {
117117
}
118118
t.plan(4)
119119

120-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc })
121-
var peer2 = new Peer({ config: config, wrtc: common.wrtc })
120+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc })
121+
var peer2 = new Peer({ config, wrtc: common.wrtc })
122122

123123
peer1.on('signal', function (data) { if (!peer2.destroyed) peer2.signal(data) })
124124
peer2.on('signal', function (data) { if (!peer1.destroyed) peer1.signal(data) })
@@ -143,12 +143,12 @@ test('add stream on non-initiator only', function (t) {
143143
t.plan(3)
144144

145145
var peer1 = new Peer({
146-
config: config,
146+
config,
147147
initiator: true,
148148
wrtc: common.wrtc
149149
})
150150
var peer2 = new Peer({
151-
config: config,
151+
config,
152152
wrtc: common.wrtc,
153153
stream: common.getMediaStream()
154154
})
@@ -171,7 +171,7 @@ test('negotiated channels', function (t) {
171171
t.plan(2)
172172

173173
var peer1 = new Peer({
174-
config: config,
174+
config,
175175
initiator: true,
176176
wrtc: common.wrtc,
177177
channelConfig: {
@@ -180,7 +180,7 @@ test('negotiated channels', function (t) {
180180
}
181181
})
182182
var peer2 = new Peer({
183-
config: config,
183+
config,
184184
wrtc: common.wrtc,
185185
channelConfig: {
186186
id: 1,

test/object-mode.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ test('get config', function (t) {
1414
test('data send/receive string {objectMode: true}', function (t) {
1515
t.plan(6)
1616

17-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc, objectMode: true })
18-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, objectMode: true })
17+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc, objectMode: true })
18+
var peer2 = new Peer({ config, wrtc: common.wrtc, objectMode: true })
1919
peer1.on('signal', function (data) {
2020
peer2.signal(data)
2121
})
@@ -50,8 +50,8 @@ test('data send/receive string {objectMode: true}', function (t) {
5050
test('data send/receive Buffer {objectMode: true}', function (t) {
5151
t.plan(6)
5252

53-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc, objectMode: true })
54-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, objectMode: true })
53+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc, objectMode: true })
54+
var peer2 = new Peer({ config, wrtc: common.wrtc, objectMode: true })
5555
peer1.on('signal', function (data) {
5656
peer2.signal(data)
5757
})
@@ -86,8 +86,8 @@ test('data send/receive Buffer {objectMode: true}', function (t) {
8686
test('data send/receive Uint8Array {objectMode: true}', function (t) {
8787
t.plan(6)
8888

89-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc, objectMode: true })
90-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, objectMode: true })
89+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc, objectMode: true })
90+
var peer2 = new Peer({ config, wrtc: common.wrtc, objectMode: true })
9191
peer1.on('signal', function (data) {
9292
peer2.signal(data)
9393
})
@@ -124,8 +124,8 @@ test('data send/receive Uint8Array {objectMode: true}', function (t) {
124124
test('data send/receive ArrayBuffer {objectMode: true}', function (t) {
125125
t.plan(6)
126126

127-
var peer1 = new Peer({ config: config, initiator: true, wrtc: common.wrtc, objectMode: true })
128-
var peer2 = new Peer({ config: config, wrtc: common.wrtc, objectMode: true })
127+
var peer1 = new Peer({ config, initiator: true, wrtc: common.wrtc, objectMode: true })
128+
var peer2 = new Peer({ config, wrtc: common.wrtc, objectMode: true })
129129
peer1.on('signal', function (data) {
130130
peer2.signal(data)
131131
})

0 commit comments

Comments
 (0)