node-consumer-pact-validation
Version:
A consumer pact generator written for pure nodeJS
62 lines (61 loc) • 1.52 kB
JSON
{
"match": true,
"comment": "top level array matches",
"expected": {
"headers": {"Content-Type": "application/json"},
"body" : [ {
"dob" : "06/11/2015",
"name" : "Rogger the Dogger",
"id" : 3380634027,
"timestamp" : "2015-06-11T13:17:29"
}, {
"dob" : "06/11/2015",
"name" : "Cat in the Hat",
"id" : 1284270029,
"timestamp" : "2015-06-11T13:17:29"
} ],
"matchingRules" : {
"$.body[0].id" : {
"match" : "type"
},
"$.body[1].id" : {
"match" : "type"
},
"$.body[0].name" : {
"match" : "type"
},
"$.body[1].name" : {
"match" : "type"
},
"$.body[1].dob" : {
"match": "regex", "regex" : "\\d{2}/\\d{2}/\\d{4}"
},
"$.body[1].timestamp" : {
"match": "regex", "regex" : "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}"
},
"$.body[0].timestamp" : {
"match": "regex", "regex" : "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}"
},
"$.body[0].dob" : {
"match": "regex", "regex" : "\\d{2}/\\d{2}/\\d{4}"
}
}
},
"actual": {
"headers": {"Content-Type": "application/json"},
"body": [
{
"dob": "11/06/2015",
"name": "Bob The Builder",
"id": 1234567890,
"timestamp": "2000-06-10T20:41:37"
},
{
"dob": "12/10/2000",
"name": "Slinky Malinky",
"id": 6677889900,
"timestamp": "2015-06-10T22:98:78"
}
]
}
}