You could use something like this to loop through and filter the objects that contain items
greater than 300
. It will create an array that you can assert against the length of to see if it’s above 1
.
I’ve added in a custom error string that shows you why it failed.
pm.test('Is atleast one of the batch in future >=300', () => {
let result = pm.response.json().filter(arr => arr.items >= 300)
pm.expect(result.length).to.be.above(1, `Objects matching condition ${result.length}`)
})
This will give you an idea of other assertions that could be made in the pm.expect()
statements: