Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diehuxx committed Oct 1, 2024
1 parent 25669d2 commit a0fe4aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions crates/web5/src/credentials/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,11 @@ mod tests {
.await;

match result {
Err(Web5Error::Http(err)) => {
Err(Web5Error::Network(err)) => {
assert!(err.to_string().contains("error sending request"))
}
_ => panic!(
"expected Web5Error::Http with specific message but got {:?}",
"expected Web5Error::Network with specific message but got {:?}",
result
),
};
Expand All @@ -636,11 +636,11 @@ mod tests {
.await;

match result {
Err(Web5Error::JsonSchema(err_msg)) => {
assert_eq!("failed to resolve status code 500", err_msg)
Err(Web5Error::Network(err_msg)) => {
assert!(err_msg.contains("Failed to fetch credential schema"))
}
_ => panic!(
"expected Web5Error::JsonSchema with specific message but got {:?}",
"expected Web5Error::Network with specific message but got {:?}",
result
),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/web5/src/credentials/credential_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub(crate) async fn validate_credential_schema(
.map_err(|e| Web5Error::Network(format!("Failed to fetch credential schema: {}", e)))?;

if !(200..300).contains(&response.status_code) {
return Err(Web5Error::Http(format!(
return Err(Web5Error::Network(format!(
"Failed to fetch credential schema: non-successful response code {}",
response.status_code
)));
Expand Down
10 changes: 5 additions & 5 deletions crates/web5/src/credentials/verifiable_credential_1_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,11 +813,11 @@ mod tests {
let result = VerifiableCredential::from_vc_jwt(vc_jwt_with_invalid_url, true).await;

match result {
Err(Web5Error::Http(err)) => {
Err(Web5Error::Network(err)) => {
assert!(err.to_string().contains("error sending request"))
}
_ => panic!(
"expected Web5Error::Http with specific message but got {:?}",
"expected Web5Error::Network with specific message but got {:?}",
result
),
};
Expand All @@ -839,11 +839,11 @@ mod tests {

let result = VerifiableCredential::from_vc_jwt(vc_jwt_at_port, true).await;
match result {
Err(Web5Error::JsonSchema(err_msg)) => {
assert_eq!("failed to resolve status code 500", err_msg)
Err(Web5Error::Network(err_msg)) => {
assert!(err_msg.contains("Failed to fetch credential schema"))
}
_ => panic!(
"expected Web5Error::JsonSchema with specific message but got {:?}",
"expected Web5Error::Network with specific message but got {:?}",
result
),
}
Expand Down

0 comments on commit a0fe4aa

Please sign in to comment.