From 4bc9f42033e5d0857975b6ef784475a01a7444d5 Mon Sep 17 00:00:00 2001 From: Dan Enman Date: Wed, 15 May 2024 23:09:24 -0300 Subject: [PATCH] test: test for did-web parsing for id with encoded port --- crates/web5/src/dids/methods/web/resolver.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/web5/src/dids/methods/web/resolver.rs b/crates/web5/src/dids/methods/web/resolver.rs index 2684cad2..070c0f83 100644 --- a/crates/web5/src/dids/methods/web/resolver.rs +++ b/crates/web5/src/dids/methods/web/resolver.rs @@ -95,5 +95,19 @@ mod tests { let did_uri = "did:web:tbd.website:with:path"; let result = Resolver::new(Identifier::parse(did_uri).unwrap()); assert_eq!(result.did_url, "https://tbd.website/with/path/did.json"); + + let did_uri = "did:web:tbd.website%3A8080"; + let result = Resolver::new(Identifier::parse(did_uri).unwrap()); + assert_eq!( + result.did_url, + "https://tbd.website:8080/.well-known/did.json" + ); + + let did_uri = "did:web:tbd.website%3A8080:with:path"; + let result = Resolver::new(Identifier::parse(did_uri).unwrap()); + assert_eq!( + result.did_url, + "https://tbd.website:8080/with/path/did.json" + ); } }