We have 2 services where one is the consumer of the other. The consumer is written in Java and the provider is written in JavaScript.
On the consumer side we've defined a consumer-contract-test using pact-jvm and we're able to generate a contract. In this contract the response is defined like:
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
"test"
]
},
On our provider we are now trying to define a provider-contract-test using pact-js but we are hitting a problem where in pact-js we are using a MessageProviderPact to verify the contract. But when running the test, the body is expected to be in a content attribute like this:
Key: - is expected
+ is actual
Matching keys and values are not shown
-[
- "test"
-]
+{
+ "contents": {
+ "statusCode": 200,
+ "body": "[test]"
+ }
+}
Code used for pact verification
const p = new MessageProviderPact({
messageProviders: {
'': handler
},
provider: 'provider-service',
pactUrls: [
path.resolve(
process.cwd(),
'pacts',
'consumer-service-provider-service.json'
)
]
});
Any idea's on how to solve this? Is it possible to use a similar message structure with content key on the consumer side? Or can we solve it any other way on the provider side
MessageProviderPactwas the wrong choice here. Using the standardVerifierclass it's working - bvdwater