We are developing API’s and I need the ability to verify the entire payload of certain response bodies with exception of a dynamic “generateDateTime”: “2020-03-09T16:24:50.58”, value. I’m using lodash test snippet below which works perfectly for static response bodies that have no dynamic values… But I need a solution for either verifying the static response body + the dynamic “generateDateTime”: or to somehow exclude the “generateDateTime”: value in the test assertion.
var jsonData = JSON.parse(responseBody);
var _ = require(‘lodash’);
tests[“Correct Response Body is Returned”] = _.isEqual(jsonData,
“My Response Body”