From ba2a99aa5fc1196e669acdcb49c13eb2f99f7e72 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 21 Nov 2024 13:41:31 +0100 Subject: [PATCH] fix `can_validate_domain` test --- bindings/grpc/tests/api/domain_linkage.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bindings/grpc/tests/api/domain_linkage.rs b/bindings/grpc/tests/api/domain_linkage.rs index 05819710d..96b7b933a 100644 --- a/bindings/grpc/tests/api/domain_linkage.rs +++ b/bindings/grpc/tests/api/domain_linkage.rs @@ -125,16 +125,25 @@ async fn can_validate_domain() -> anyhow::Result<()> { did_configuration: configuration_resource.to_string(), }) .await?; - let did_id = IotaDocument::from_json(&did)?.id().to_string(); + + // created and updated are retrieved directly from the contract and not from the given DID document, + // so we'll replace them with values from the result for the check here + let validated_did_response = response.into_inner(); + let mut did_document: IotaDocument = IotaDocument::from_json(&did)?; + let did_id = did_document.id().to_string(); + let response_did_document: IotaDocument = + serde_json::from_str(&validated_did_response.linked_dids.as_ref().unwrap().valid[0].did).unwrap(); + did_document.metadata.created = response_did_document.metadata.created; + did_document.metadata.updated = response_did_document.metadata.updated; assert_eq!( - response.into_inner(), + validated_did_response, ValidateDomainResponse { linked_dids: Some(LinkedDids { invalid: vec![], valid: vec![ValidDid { service_id: did_id, - did: did.to_string().clone(), + did: did_document.to_string().clone(), credential: jwt.as_str().to_string(), }] }),