I’m trying to verify TotalMessageUI_ObjectClicked
contains a value other than NULL or 0
But I keep getting this error:
AssertionError: expected [ { payload: { data: [Object] } } ] to have property ‘TotalMessageUI_ObjectClicked’
What is the best way to verify TotalMessageUI_ObjectClicked
contains a value not NULL
{"data":{"actor":{"account":{"nrql":{"results":[{"TotalMessageUI_ObjectClicked":6}]}}}}}
Tried writing this:
expect(response.body).have.property('TotalMessageUI_ObjectClicked').to.not.be.oneOf([null, "",0])
2
Answers
You are not drilling down to the correct prop in your expected result.
The message
is telling you that
response.body
(the object you supplied) is actually[{ payload: { data: [Object] } } ]
.So you can amend your test with that info, for example: