Can anyone tell me why this JSON is throwing this property validation error:
Test object property | AssertionError: expected ‘{“LastEditDate”:“2021-08-02T12:08:29.0000000”,“ProjClass”:3,“ProjectStateID”:0,“ID”:53,“CurrentUserID”:6,“CreatedBy”:6,“SchemaName”:2}’ to have property ‘ID’
Sorry, I’m not trying to be difficult but as I understand it Postman is taking the JSON I posted and saying “no such property exists in this JSON”. Which it does. And that body I sent should be the only thing being checked in that validation. So what would the rest of the Response have to do with anything?
(this isn’t the only “no property” problem I have in Postman/Chai, this is just the one I picked to show you, that exact assert never seems to work at all, others do depending . . . but this should be a simple enough example to crack into)
Answer was endpoint was returning a string. Postman wouldn’t recognize that as JSON. Change the return type to IActionResult (C#) and wrap the same JSON in an OK() response and it all validates.