From ab3f9a567db4abdbf5e0ca4013e672e81d632aff Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Thu, 21 Dec 2023 15:18:31 +1100 Subject: [PATCH] fix(verifier): default error formatter does not display the inner error #351 --- rust/pact_verifier/src/lib.rs | 5 +- rust/pact_verifier/tests/tests.rs | 112 ++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/rust/pact_verifier/src/lib.rs b/rust/pact_verifier/src/lib.rs index 2465e43fd..993e4cfcc 100644 --- a/rust/pact_verifier/src/lib.rs +++ b/rust/pact_verifier/src/lib.rs @@ -1097,8 +1097,9 @@ pub async fn verify_provider_async = VerificationOptions::default(); + let provider_state_executor = Arc::new(DummyProviderStateExecutor{}); + let publish_options = PublishOptions { + provider_version: Some("1.2.3".to_string()), + build_url: None, + provider_tags: vec![], + provider_branch: None, + }; + + let result = verify_provider_async( + provider_info, + vec![ pact_source ], + FilterInfo::None, + vec![ "Consumer".to_string() ], + &verification_options, + Some(&publish_options), + &provider_state_executor, + None + ).await; + + let verification_result = result.unwrap(); + expect!(verification_result.result).to(be_false()); + let error = &verification_result.errors[0].1; + let error_json: Value = error.into(); + let message = error_json.as_object().unwrap().get("message").unwrap(); + let message_str = message.to_string(); + expect!(message_str.contains("consumerVersionSelectors: cannot specify the fields branch/latest with the field deployedOrReleased (at index 0)")).to(be_true()); +}