@@ -115,6 +115,14 @@ describe('multiaddr validation', function () {
115
115
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ipfs/Qma3uqwymdqwXtC4uvmqqwwMhTDHD7xp9FzM75tQB5qRM3'
116
116
]
117
117
118
+ const goodStardust = [
119
+ '/ip4/1.2.3.4/tcp/3456/ws/p2p-stardust' ,
120
+ '/ip6/::/tcp/0/ws/p2p-stardust' ,
121
+ '/dnsaddr/localhost/ws/p2p-stardust/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4' ,
122
+ '/ip4/1.2.3.4/tcp/3456/ws/p2p-stardust/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4' ,
123
+ '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-stardust/ipfs/Qma3uqwymdqwXtC4uvmqqwwMhTDHD7xp9FzM75tQB5qRM3'
124
+ ]
125
+
118
126
const badWS = [
119
127
'/ip4/0.0.0.0/tcp/12345/udp/2222/ws' ,
120
128
'/ip6/::/ip4/0.0.0.0/udp/1234/ws' ,
@@ -158,7 +166,12 @@ describe('multiaddr validation', function () {
158
166
const tests = Array . from ( arguments ) . slice ( 1 )
159
167
tests . forEach ( function ( test ) {
160
168
test . forEach ( function ( testcase ) {
161
- expect ( p . matches ( testcase ) ) . to . be . eql ( true )
169
+ try {
170
+ expect ( p . matches ( testcase ) ) . to . be . eql ( true )
171
+ } catch ( err ) {
172
+ err . stack = '[testcase=' + JSON . stringify ( testcase ) + ', shouldMatch=true] ' + err . stack
173
+ throw err
174
+ }
162
175
} )
163
176
} )
164
177
}
@@ -167,7 +180,12 @@ describe('multiaddr validation', function () {
167
180
const tests = Array . from ( arguments ) . slice ( 1 )
168
181
tests . forEach ( function ( test ) {
169
182
test . forEach ( function ( testcase ) {
170
- expect ( p . matches ( testcase ) ) . to . be . eql ( false )
183
+ try {
184
+ expect ( p . matches ( testcase ) ) . to . be . eql ( false )
185
+ } catch ( err ) {
186
+ err . stack = '[testcase=' + JSON . stringify ( testcase ) + ', shouldMatch=false] ' + err . stack
187
+ throw err
188
+ }
171
189
} )
172
190
} )
173
191
}
@@ -227,6 +245,11 @@ describe('multiaddr validation', function () {
227
245
assertMismatches ( mafmt . WebSocketStar , goodIP , goodUDP , badWS )
228
246
} )
229
247
248
+ it ( 'Stardust validation' , function ( ) {
249
+ assertMatches ( mafmt . Stardust , goodStardust )
250
+ assertMismatches ( mafmt . Stardust , goodIP , goodUDP , badWS )
251
+ } )
252
+
230
253
it ( 'WebRTCStar validation' , function ( ) {
231
254
assertMatches ( mafmt . WebRTCStar , goodWebRTCStar )
232
255
assertMismatches ( mafmt . WebRTCStar , goodIP , goodUDP , badWS )
0 commit comments