@@ -22,6 +22,8 @@ describe('multiaddr matcher', () => {
22
22
]
23
23
24
24
const badDNS = [
25
+ null ,
26
+ undefined ,
25
27
'/ip4/127.0.0.1'
26
28
]
27
29
@@ -44,6 +46,8 @@ describe('multiaddr matcher', () => {
44
46
]
45
47
46
48
const badIP = [
49
+ null ,
50
+ undefined ,
47
51
'/udp/789/ip6/fc00::'
48
52
]
49
53
@@ -64,6 +68,8 @@ describe('multiaddr matcher', () => {
64
68
]
65
69
66
70
const badTCP = [
71
+ null ,
72
+ undefined ,
67
73
'/tcp/12345' ,
68
74
'/ip6/fc00::/udp/5523/tcp/9543' ,
69
75
'/dns4/protocol.ai'
@@ -81,6 +87,8 @@ describe('multiaddr matcher', () => {
81
87
]
82
88
83
89
const badUDP = [
90
+ null ,
91
+ undefined ,
84
92
'/udp/12345' ,
85
93
'/ip6/fc00::/tcp/5523/udp/9543'
86
94
]
@@ -99,6 +107,8 @@ describe('multiaddr matcher', () => {
99
107
]
100
108
101
109
const badQUIC = [
110
+ null ,
111
+ undefined ,
102
112
'/ip4/0.0.0.0/tcp/12345/quic' ,
103
113
'/ip6/fc00::/ip4/0.0.0.0/udp/1234/quic' ,
104
114
'/quic'
@@ -118,6 +128,8 @@ describe('multiaddr matcher', () => {
118
128
]
119
129
120
130
const badQUICv1 = [
131
+ null ,
132
+ undefined ,
121
133
'/ip4/0.0.0.0/tcp/12345/quic-v1' ,
122
134
'/ip6/fc00::/ip4/0.0.0.0/udp/1234/quic-v1' ,
123
135
'/quic-v1' ,
@@ -186,12 +198,16 @@ describe('multiaddr matcher', () => {
186
198
]
187
199
188
200
const badWS = [
201
+ null ,
202
+ undefined ,
189
203
'/ip4/0.0.0.0/tcp/12345/udp/2222/ws' ,
190
204
'/ip6/::/ip4/0.0.0.0/udp/1234/ws' ,
191
205
'/ip4/127.0.0.1/tcp/24642/p2p-webrtc-star/ws'
192
206
]
193
207
194
208
const badWSS = [
209
+ null ,
210
+ undefined ,
195
211
'/ip4/0.0.0.0/tcp/12345/udp/2222/wss' ,
196
212
'/ip6/::/ip4/0.0.0.0/udp/1234/wss' ,
197
213
'/ip4/127.0.0.1/tcp/24642/p2p-webrtc-star/wss'
@@ -209,6 +225,8 @@ describe('multiaddr matcher', () => {
209
225
]
210
226
211
227
const badCircuit = [
228
+ null ,
229
+ undefined ,
212
230
'/ip4/0.0.0.0/tcp/12345/udp/2222/wss' ,
213
231
'/ip4/0.0.7.6/udp/1234' ,
214
232
'/ip6/::/udp/0/utp' ,
@@ -245,6 +263,8 @@ describe('multiaddr matcher', () => {
245
263
]
246
264
247
265
const badWebRTCDirect = [
266
+ null ,
267
+ undefined ,
248
268
'/ip4/0.0.0.0/tcp/4004/webrtc-direct' ,
249
269
'/ip4/0.0.0.0/tcp/4004/webrtc-direct/certhash/uEiAeP0OEmBbGVTH5Bhnm3WopwRNSQ0et46xNkn2dIagnGw' ,
250
270
'/ip4/0.0.0.0/tcp/4004/webrtc-direct/certhash/uEiAeP0OEmBbGVTH5Bhnm3WopwRNSQ0et46xNkn2dIagnGw/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64' ,
@@ -266,6 +286,8 @@ describe('multiaddr matcher', () => {
266
286
]
267
287
268
288
const badWebRTC = [
289
+ null ,
290
+ undefined ,
269
291
'/ip4/0.0.0.0/udp/0/webrtc' ,
270
292
'/ip4/0.0.0.0/tcp/12345/udp/2222/wss/webrtc'
271
293
]
@@ -280,6 +302,8 @@ describe('multiaddr matcher', () => {
280
302
]
281
303
282
304
const badWebTransport = [
305
+ null ,
306
+ undefined ,
283
307
// quic instead of quic-v1
284
308
'/ip4/10.5.0.2/udp/4001/quic/webtransport/certhash/uEiDWmsTxXe55Mbwnvd1qrPZAcE5Jtc0tE9WtGXD_NpMERg/certhash/uEiCoik2HBeT5oc9Jib3SQJzNjn9AnznMDpQWcOeKSuEc9A/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v'
285
309
]
@@ -296,6 +320,8 @@ describe('multiaddr matcher', () => {
296
320
]
297
321
298
322
const badIPorDomain = [
323
+ null ,
324
+ undefined ,
299
325
'/webrtc/p2p/12D3KooWQF6Q3i1QkziJQ9mkNNcyFD8GPQz6R6oEvT75wgsVXm4v' ,
300
326
'/quic' ,
301
327
'/unix/var%2Flog'
@@ -316,6 +342,8 @@ describe('multiaddr matcher', () => {
316
342
]
317
343
318
344
const badHTTP = [
345
+ null ,
346
+ undefined ,
319
347
'/ip4/0.0.0.0/udp/80/http'
320
348
]
321
349
@@ -341,6 +369,8 @@ describe('multiaddr matcher', () => {
341
369
]
342
370
343
371
const badHTTPS = [
372
+ null ,
373
+ undefined ,
344
374
'/ip4/0.0.0.0/udp/80/http'
345
375
]
346
376
@@ -355,6 +385,8 @@ describe('multiaddr matcher', () => {
355
385
]
356
386
357
387
const badMemory = [
388
+ null ,
389
+ undefined ,
358
390
'/ip4/0.0.0.0/udp/80/http'
359
391
]
360
392
@@ -370,6 +402,8 @@ describe('multiaddr matcher', () => {
370
402
]
371
403
372
404
const badPeer = [
405
+ null ,
406
+ undefined ,
373
407
'/ip4/0.0.0.0/udp/80/http' ,
374
408
'/memory/0xDEADBEEF'
375
409
]
@@ -384,6 +418,8 @@ describe('multiaddr matcher', () => {
384
418
]
385
419
386
420
const badUnix = [
421
+ null ,
422
+ undefined ,
387
423
'/ip4/0.0.0.0/tcp/0/https'
388
424
]
389
425
@@ -403,7 +439,7 @@ describe('multiaddr matcher', () => {
403
439
} )
404
440
}
405
441
406
- function assertMismatches ( p : MultiaddrMatcher , ...tests : string [ ] [ ] ) : void {
442
+ function assertMismatches ( p : MultiaddrMatcher , ...tests : Array < Array < string | null | undefined > > ) : void {
407
443
tests . forEach ( ( test ) => {
408
444
test . forEach ( ( testcase ) => {
409
445
expect ( p . matches ( multiaddr ( testcase ) ) ) . to . equal ( false , `${ testcase } matched when it should not have` )
0 commit comments