Guillermo
02/17/2022, 8:12 PMeachLike
only works when an array has the same object in each index.
Here is an example JSON that needs to be matched :
{
"version": 1234,
"data": [
{
"name": "someName"
},
{
"name": "anotherName",
"id": 131312
}
]
}
As you see using an eachLike on data wouldn't work because of the extra id
field. Does anyone know how I can achieve this? I've look at the documentation, but I can't seem to figure it out. Thanks!Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Guillermo
02/17/2022, 10:44 PMMatt (pactflow.io / pact-js / pact-go)
Guillermo
02/18/2022, 2:45 PMwithBody
closure. ex:
.withBody({
data arrayContaining({
name string()
}, {
name string()
id integer()
})
})
Guillermo
02/18/2022, 2:47 PMdata
key emptyGuillermo
02/18/2022, 2:48 PMdata : {}
Guillermo
02/18/2022, 2:48 PMGuillermo
02/18/2022, 2:49 PMeachLike
it will populate that field with correct fields/values arrayGuillermo
02/18/2022, 3:51 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)