Hello, my existing provider test failed because an...
# pact-js
m
Hello, my existing provider test failed because an array now has more than one entry. So i changed the contract expectation to
Copy code
urlParams: eachLike({
    urlParameterName:string(),
    navigatorUrlParameterType: string(),
}),
My Provider test still fails because there are multiple entries. I already used the eachLike feature and didn't have an issue with it. Am i missing something?
m
Can you please share the generated contract file and the exact error when verifying?
m
1.1) body: $.contextLinks.navigatorGroups.1.navigatorList.0.urlConstructionInformation.urlParams Expected a List with 1 elements but received 3 elements [ { - "navigatorUrlParameterType": "iloveorange", - "urlParameterName": "iloveorange" + "navigatorUrlParameterType": "STANDARD", + "urlParameterName": "location" + }, + { + "navigatorUrlParameterType": "STANDARD", + "urlParameterName": "lat" + }, + { + "navigatorUrlParameterType": "STANDARD", + "urlParameterName": "long" } ]
Copy code
"urlConstructionInformation": {
  "baseUrl": {
    "id": "iloveorange",
    "description": "iloveorange",
    "method": "iloveorange",
    "serviceName": "iloveorange",
    "uri": "iloveorange"
  },
  "urlParams": [
    {
      "urlParameterName": "iloveorange",
      "navigatorUrlParameterType": "iloveorange"
    }
  ]
}
Copy code
"$.body.contextLinks.navigatorGroups[1].navigatorList[0].urlConstructionInformation.urlParams": {
  "min": 1
},
"$.body.contextLinks.navigatorGroups[1].navigatorList[0].urlConstructionInformation.urlParams[*].*": {
  "match": "type"
},
"$.body.contextLinks.navigatorGroups[1].navigatorList[0].urlConstructionInformation.urlParams[*].urlParameterName": {
  "match": "type"
},
"$.body.contextLinks.navigatorGroups[1].navigatorList[0].urlConstructionInformation.urlParams[*].navigatorUrlParameterType": {
  "match": "type"
},
Update: The Test works but only on my local pact broker, on DEV pactbroker it doesnt work. So i compared bothc contracts and they are the same.
m
hmmm that doesn’t make sense. The Pact broker actually doesn’t care about the contents of the contract. My guess is that the provider test is not validating the same contract. You should be able to see the version of the contract being verified in the logs.
This would mean that the verification process is not selecting the correct pacts from the broker
m
Yes you are exactly right. My versioning is wrong. It verifies the wrong pact.
👍 1
m
Just so I’m clear, why are you running a local pact broker? Just for testing purposes? You would usually only hae a single pact broker (not one for Dev, Test, Prod etc.)
m
Yeah its just for Testing Purposes
👍 1