Tests are passing that should fail


New to both Postman & JS. I am trying to check the values in a JSON response from an API. I expect some tests to fail as I am checking for a value that is not present but my tests are passing & I am not sure why?

The response JSON is structured as follows:-

        "details": [
                        "number": "1234",
                        "type": "integer",
                        "name": "array"

The negative test I’ve written is as follows:-

pm.test("Type "), function () {

I expected this to fail but it passed. I think it may be down to having an object within an array. Any help would be appreciated.

This shouldn’t have the closing bracket as it’s kinda stopping the test there. If you remove that it should show the expected result.

1 Like

Thanks Danny, got it working now.

1 Like