@@ -24,7 +24,7 @@ const dirtyChai = require('dirty-chai')
24
24
const expect = chai . expect
25
25
chai . use ( dirtyChai )
26
26
27
- describe ( ` dialer tests` , function ( ) {
27
+ describe ( ' dialer tests' , function ( ) {
28
28
let dialer
29
29
30
30
beforeEach ( ( ) => {
@@ -35,22 +35,22 @@ describe(`dialer tests`, function () {
35
35
sinon . restore ( )
36
36
} )
37
37
38
- describe ( ` .dial` , function ( ) {
38
+ describe ( ' .dial' , function ( ) {
39
39
beforeEach ( function ( ) {
40
40
dialer . relayPeers = new Map ( )
41
41
dialer . relayPeers . set ( nodes . node2 . id , new Connection ( ) )
42
42
dialer . relayPeers . set ( nodes . node3 . id , new Connection ( ) )
43
43
dialer . dial . callThrough ( )
44
44
} )
45
45
46
- it ( ` fail on non circuit addr` , function ( ) {
46
+ it ( ' fail on non circuit addr' , function ( ) {
47
47
const dstMa = multiaddr ( `/ipfs/${ nodes . node4 . id } ` )
48
48
expect ( ( ) => dialer . dial ( dstMa , ( err ) => {
49
49
err . to . match ( / i n v a l i d c i r c u i t a d d r e s s / )
50
50
} ) )
51
51
} )
52
52
53
- it ( ` dial a peer` , function ( done ) {
53
+ it ( ' dial a peer' , function ( done ) {
54
54
const dstMa = multiaddr ( `/p2p-circuit/ipfs/${ nodes . node3 . id } ` )
55
55
dialer . _dialPeer . callsFake ( function ( dstMa , relay , callback ) {
56
56
return callback ( null , dialer . relayPeers . get ( nodes . node3 . id ) )
@@ -63,7 +63,7 @@ describe(`dialer tests`, function () {
63
63
} )
64
64
} )
65
65
66
- it ( ` dial a peer over the specified relay` , function ( done ) {
66
+ it ( ' dial a peer over the specified relay' , function ( done ) {
67
67
const dstMa = multiaddr ( `/ipfs/${ nodes . node3 . id } /p2p-circuit/ipfs/${ nodes . node4 . id } ` )
68
68
dialer . _dialPeer . callsFake ( function ( dstMa , relay , callback ) {
69
69
expect ( relay . toString ( ) ) . to . equal ( `/ipfs/${ nodes . node3 . id } ` )
@@ -78,7 +78,7 @@ describe(`dialer tests`, function () {
78
78
} )
79
79
} )
80
80
81
- describe ( ` .canHop` , function ( ) {
81
+ describe ( ' .canHop' , function ( ) {
82
82
let fromConn = null
83
83
const peer = new PeerInfo ( PeerId . createFromB58String ( 'QmQWqGdndSpAkxfk8iyiJyz3XXGkrDNujvc8vEst3baubA' ) )
84
84
@@ -94,7 +94,7 @@ describe(`dialer tests`, function () {
94
94
dialer . _dialRelayHelper . callThrough ( )
95
95
} )
96
96
97
- it ( ` should handle successful CAN_HOP` , ( done ) => {
97
+ it ( ' should handle successful CAN_HOP' , ( done ) => {
98
98
dialer . _dialRelay . callsFake ( ( _ , cb ) => {
99
99
pull (
100
100
values ( [ {
@@ -114,7 +114,7 @@ describe(`dialer tests`, function () {
114
114
} )
115
115
} )
116
116
117
- it ( ` should handle failed CAN_HOP` , function ( done ) {
117
+ it ( ' should handle failed CAN_HOP' , function ( done ) {
118
118
dialer . _dialRelay . callsFake ( ( _ , cb ) => {
119
119
pull (
120
120
values ( [ {
@@ -135,7 +135,7 @@ describe(`dialer tests`, function () {
135
135
} )
136
136
} )
137
137
138
- describe ( ` ._dialPeer` , function ( ) {
138
+ describe ( ' ._dialPeer' , function ( ) {
139
139
beforeEach ( function ( ) {
140
140
dialer . relayPeers = new Map ( )
141
141
dialer . relayPeers . set ( nodes . node1 . id , new Connection ( ) )
@@ -144,14 +144,14 @@ describe(`dialer tests`, function () {
144
144
dialer . _dialPeer . callThrough ( )
145
145
} )
146
146
147
- it ( ` should dial a peer over any relay` , function ( done ) {
147
+ it ( ' should dial a peer over any relay' , function ( done ) {
148
148
const dstMa = multiaddr ( `/ipfs/${ nodes . node4 . id } ` )
149
149
dialer . _negotiateRelay . callsFake ( function ( conn , dstMa , callback ) {
150
150
if ( conn === dialer . relayPeers . get ( nodes . node3 . id ) ) {
151
151
return callback ( null , dialer . relayPeers . get ( nodes . node3 . id ) )
152
152
}
153
153
154
- callback ( new Error ( ` error` ) )
154
+ callback ( new Error ( ' error' ) )
155
155
} )
156
156
157
157
dialer . _dialPeer ( dstMa , ( err , conn ) => {
@@ -162,22 +162,22 @@ describe(`dialer tests`, function () {
162
162
} )
163
163
} )
164
164
165
- it ( ` should fail dialing a peer over any relay` , function ( done ) {
165
+ it ( ' should fail dialing a peer over any relay' , function ( done ) {
166
166
const dstMa = multiaddr ( `/ipfs/${ nodes . node4 . id } ` )
167
167
dialer . _negotiateRelay . callsFake ( function ( conn , dstMa , callback ) {
168
- callback ( new Error ( ` error` ) )
168
+ callback ( new Error ( ' error' ) )
169
169
} )
170
170
171
171
dialer . _dialPeer ( dstMa , ( err , conn ) => {
172
172
expect ( conn ) . to . be . undefined ( )
173
173
expect ( err ) . to . not . be . null ( )
174
- expect ( err ) . to . equal ( ` no relay peers were found or all relays failed to dial` )
174
+ expect ( err ) . to . equal ( ' no relay peers were found or all relays failed to dial' )
175
175
done ( )
176
176
} )
177
177
} )
178
178
} )
179
179
180
- describe ( ` ._negotiateRelay` , function ( ) {
180
+ describe ( ' ._negotiateRelay' , function ( ) {
181
181
const dstMa = multiaddr ( `/ipfs/${ nodes . node4 . id } ` )
182
182
183
183
let conn = null
@@ -188,7 +188,7 @@ describe(`dialer tests`, function () {
188
188
PeerId . createFromJSON ( nodes . node4 , ( _ , peerId ) => {
189
189
PeerInfo . create ( peerId , ( err , peerInfo ) => {
190
190
peer = peerInfo
191
- peer . multiaddrs . add ( ` /p2p-circuit/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE` )
191
+ peer . multiaddrs . add ( ' /p2p-circuit/ipfs/QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE' )
192
192
done ( err )
193
193
} )
194
194
} )
@@ -202,12 +202,12 @@ describe(`dialer tests`, function () {
202
202
dialer . relayConns = new Map ( )
203
203
dialer . _negotiateRelay . callThrough ( )
204
204
dialer . _dialRelayHelper . callThrough ( )
205
- peer = new PeerInfo ( PeerId . createFromB58String ( ` QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE` ) )
205
+ peer = new PeerInfo ( PeerId . createFromB58String ( ' QmSswe1dCFRepmhjAMR5VfHeokGLcvVggkuDJm7RMfJSrE' ) )
206
206
p = pair ( )
207
207
conn = new Connection ( p [ 1 ] )
208
208
} )
209
209
210
- it ( ` should write the correct dst addr` , function ( done ) {
210
+ it ( ' should write the correct dst addr' , function ( done ) {
211
211
dialer . _dialRelay . callsFake ( ( _ , cb ) => {
212
212
pull (
213
213
p [ 0 ] ,
@@ -228,7 +228,7 @@ describe(`dialer tests`, function () {
228
228
dialer . _negotiateRelay ( peer , dstMa , done )
229
229
} )
230
230
231
- it ( ` should negotiate relay` , function ( done ) {
231
+ it ( ' should negotiate relay' , function ( done ) {
232
232
dialer . _dialRelay . callsFake ( ( _ , cb ) => {
233
233
pull (
234
234
p [ 0 ] ,
@@ -253,7 +253,7 @@ describe(`dialer tests`, function () {
253
253
} )
254
254
} )
255
255
256
- it ( ` should fail with an invalid peer id` , function ( done ) {
256
+ it ( ' should fail with an invalid peer id' , function ( done ) {
257
257
const dstMa = multiaddr ( '/ip4/127.0.0.1/tcp/4001' )
258
258
dialer . _dialRelay . callsFake ( ( _ , cb ) => {
259
259
pull (
@@ -279,7 +279,7 @@ describe(`dialer tests`, function () {
279
279
} )
280
280
} )
281
281
282
- it ( ` should handle failed relay negotiation` , function ( done ) {
282
+ it ( ' should handle failed relay negotiation' , function ( done ) {
283
283
dialer . _dialRelay . callsFake ( ( _ , cb ) => {
284
284
cb ( null , conn )
285
285
pull (
@@ -295,7 +295,7 @@ describe(`dialer tests`, function () {
295
295
dialer . _negotiateRelay ( peer , dstMa , ( err , conn ) => {
296
296
expect ( err ) . to . not . be . null ( )
297
297
expect ( err ) . to . be . an . instanceOf ( Error )
298
- expect ( err . message ) . to . be . equal ( ` Got 400 error code trying to dial over relay` )
298
+ expect ( err . message ) . to . be . equal ( ' Got 400 error code trying to dial over relay' )
299
299
done ( )
300
300
} )
301
301
} )
0 commit comments