File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2317,6 +2317,19 @@ mod tests {
2317
2317
) ;
2318
2318
}
2319
2319
2320
+ #[ test]
2321
+ fn colon_in_prefix_is_valid ( ) {
2322
+ let mock_api = MockApi :: default ( ) . with_prefix ( "did:com:" ) ;
2323
+ let addr = mock_api
2324
+ . addr_validate ( "did:com:1jkf0kmeyefvyzpwf56m7sne2000ay53r6upttu" )
2325
+ . unwrap ( ) ;
2326
+
2327
+ assert_eq ! (
2328
+ addr. as_str( ) ,
2329
+ "did:com:1jkf0kmeyefvyzpwf56m7sne2000ay53r6upttu"
2330
+ ) ;
2331
+ }
2332
+
2320
2333
#[ test]
2321
2334
#[ should_panic( expected = "Generating address failed with reason: invalid length" ) ]
2322
2335
fn making_an_address_with_empty_prefix_should_panic ( ) {
Original file line number Diff line number Diff line change @@ -297,4 +297,19 @@ mod tests {
297
297
. unwrap_err( ) ,
298
298
BackendError :: UserErr { msg } if msg. contains( "address length" ) ) ) ;
299
299
}
300
+
301
+ #[ test]
302
+ fn colon_in_prefix_is_valid ( ) {
303
+ let mock_api = MockApi :: default ( ) . with_prefix ( "did:com:" ) ;
304
+ let bytes = mock_api
305
+ . canonical_address ( "did:com:1jkf0kmeyefvyzpwf56m7sne2000ay53r6upttu" )
306
+ . 0
307
+ . unwrap ( ) ;
308
+ let humanized = mock_api. human_address ( & bytes) . 0 . unwrap ( ) ;
309
+
310
+ assert_eq ! (
311
+ humanized. as_str( ) ,
312
+ "did:com:1jkf0kmeyefvyzpwf56m7sne2000ay53r6upttu"
313
+ ) ;
314
+ }
300
315
}
You can’t perform that action at this time.
0 commit comments