# Test producing a false pass when response body has a json value equal to something

**URL:** <https://community.postman.com/t/test-producing-a-false-pass-when-response-body-has-a-json-value-equal-to-something/29626>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [November 11, 2021, 5:01pm UTC](https://community.postman.com/t/test-producing-a-false-pass-when-response-body-has-a-json-value-equal-to-something/29626 "2021-11-11T17:01:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [November 12, 2021, 9:00am UTC](https://community.postman.com/t/test-producing-a-false-pass-when-response-body-has-a-json-value-equal-to-something/29626/3 "2021-11-12T09:00:30Z")

</div>

Hey @farahziya, Welcome to the community 🥳 !

I think this solution is similar to what you are looking for. Just tune it according to your requirements.

> [@What is wrong with pm.expect](https://community.postman.com/t/what-is-wrong-with-pm-expect/29334/6):
>
> Hey @hasmukhpatel ! If you want to check if ‘data’ has all properties, you can iterate through each and perform assertion. Here is one way to achieve it: let jsonData = pm.response.json(); console.log(jsonData.data); pm.test("All keys present",()=\>{ \_.each(jsonData.data, (item)=\>{ pm.expect(item.hasOwnProperty('start\_date')).to.be.true; pm.expect(item.hasOwnProperty('score')).to.be.true; pm.expect(item.hasOwnProperty('unit')).to.be.true; pm.expect(item.hasOwnProperty('st…

Hope it helps,  
Good luck!

---

_[View the full topic](https://community.postman.com/t/test-producing-a-false-pass-when-response-body-has-a-json-value-equal-to-something/29626)._
