Looking for some assistance in verifying that the date in a request is exactly Today. I've tried various methods from the documentation, but haven't achieved the desired outcome yet. Calling out to any helpful souls who can guide a junior QA through this challenge :)
One approach I attempted (suggested by a colleague and seems promising based on the documentation)
{
"request": {
"urlPath": "/test/calc",
"method": "POST",
"headers": {
"Accept": {
"equalTo": "application/json"
},
"Content-Type": {
"equalTo": "application/json"
}
},
"bodyPatterns": [
{
"matchesJsonPath": {
"expression": "$.addDate",
"and": [
{
"before": "now + 1 days"
},
{
"after": "now - 1 days"
}
]
},
"equalToJson": {
"RequestBody": {
"order": {
"positionList": [
{
"id": 1,
"addDate": "${json-unit.any-string}",
"qty": 1
}
]
}
}
},
"ignoreArrayOrder": false
}
]
},
"response": {
"transformers": [
"response-template"
],
"status": 200,
"bodyFileName": "v1/test-service-mock-response.json",
"headers": {
"Content-Type": "application/json"
}
}
}
Hoping to validate the parameter "addDate" in the request. The date format should be like "addDate": "2022-03-31".
*Also experimented with this variation "addDate": "{{now format='yyyy-MM-dd'}}" without success. Wiremock didn't seem to match requests with this setup.