This is my response json
{
âContactMethodsâ: [
{
âidClientContactMethodâ: 1507408,
âcontactMethodâ: {
âdescriptionâ: âTELEFONO TRABAJOâ,
âidContactMethodâ: 3
},
âvalueâ: ââ,
âacceptOffersâ: false,
âisMainâ: true,
âcreatedDateâ: â02/12/2019 21:32:52â,
âcreatedUserâ: âyyyyâ,
âmodifiedDateâ: â06/12/2019 14:14:52â,
âmodifiedUserâ: â1911201â
},
{
âidClientContactMethodâ: 1507388,
âcontactMethodâ: {
âdescriptionâ: âTELEFONOâ,
âidContactMethodâ: 2
},
âvalueâ: â987654321â,
âacceptOffersâ: true,
âisMainâ: true,
âcreatedDateâ: â02/12/2019 17:33:30â,
âcreatedUserâ: â1911201â,
âmodifiedDateâ: â02/12/2019 17:33:30â,
âmodifiedUserâ: â1911201â
},
{
âidClientContactMethodâ: 1507386,
âcontactMethodâ: {
âdescriptionâ: âCELULARâ,
âidContactMethodâ: 1
},
âvalueâ: âvalfforâ,
âacceptOffersâ: false,
âisMainâ: true,
âcreatedDateâ: â02/12/2019 17:04:13â,
âcreatedUserâ: â1911201â,
âmodifiedDateâ: â02/12/2019 17:04:13â,
âmodifiedUserâ: â1911201â
},
{
âidClientContactMethodâ: 3533,
âcontactMethodâ: {
âdescriptionâ: âTELEFONOâ,
âidContactMethodâ: 2
},
âvalueâ: â8183548â,
âacceptOffersâ: false,
âisMainâ: false,
âcreatedDateâ: â17/11/2019 00:00:00â,
âcreatedUserâ: âCarga Inicialâ,
âmodifiedDateâ: â22/11/2019 18:22:56â,
âmodifiedUserâ: âCARGA INICIALâ
}
]
}
and the validation I was doing in this way but it generates an error
var _ = require(âlodashâ),
// Parse the array returned in the response body (It is probably a stringified response)
responseArray = JSON.parse(responseBody);
console.log(responseArray);
pm.test(âValidate Date ContactMethodsâ, () => {
// Use the responseArray here
var expectedSortedOrder = _.orderBy(responseArray.ContactMethods, [âmodifiedDateâ],[âDESCâ]);
pm.expect(responseArray.ContactMethods).to.eql(expectedSortedOrder);
});