I want to assert the boolean data type in the postman. The data value could have true or false. How should we achieve this? I m using this code to verify but it will pass only if it's true but I want to validate if the value is false as well.
pm.test("Verify the past event dvr details", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.data.entries[0].live_stream_rule.target_stream.dvr.is_available).to.be.true;
});
If this what you're thinking of?
const isAvailable = jsonData.data.entries[0].live_stream_rule.target_stream.dvr.is_available
pm.expect(typeof isAvailable).to.be('boolean')
pm.test("Verify the past event dvr details", function () { var jsonData = pm.response.json(); pm.expect(jsonData.data.entries[0].live_stream_rule.target_stream.dvr.is_available).to.be.a("boolean"); });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.