Quantcast
Channel: Postman API testing: Unable to assert a value is true - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Danny Dainton for Postman API testing: Unable to assert a value is true

$
0
0

You could also just do this:

pm.test('Check the response body properties', () => {    _.each(pm.response.json(), (item) => {        pm.expect(item.Verified).to.be.true        pm.expect(item.VerifiedDate).to.be.a('string').and.match(/^\d{4}-\d{2}-\d{2}$/)    })})

The check will do a few things for you, it will iterate over the whole array and check that the Verified property is true and also check that the VerifiedDate is a string and matches the YYYY-MM-DD format, like in the example given in your question.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>