Test that response doesn't contain a specific word

My response body is like below

{
    "jsonrpc": "2.0",
    "id": "1",
    "result": "0x129d421"
}

I want to write a test like, in whole JSON response body there should not be any “error” word

So my test should handle any of the below word combination & should pass
error, Error, Errors, errors, Error’s, error’s etc

How can I write test for that ?

Thank You

Parse the response to text() and then use a simple includes assertion.

const response = pm.response.text();

let errors = ["error", "Error", "Errors", "errors", "Error’s", "error’s"];

pm.test('Response does not have any errors', () => {
    pm.expect(response).to.not.include.oneOf(errors);
});

Thank You for the suggestion & help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.