-1

Given the following transaction reply how would I form a pm.test assertion for it?

{
    "data": {
        "clearEmployerClaim": true
    }
}

This isn't working for me:

pm.test("clear employer claim status returned", () => { 
    const response = pm.response.json(); 
    pm.expect(response.clearEmployerClaim).to.be.true;
});

I would normally do it like this but I'm getting type errors when running this via Jenkins/Newman. It works fine run via Postman.

tests["C536773447 clear employer claim status returned"] = body.data.clearEmployerClaim === true;

Any help is appreciated.

Sulteric
  • 505
  • 6
  • 16

1 Answers1

1

You missed one level here.

pm.expect(response.clearEmployerClaim).to.be.true; --> pm.expect(response.data.clearEmployerClaim).to.be.true;

lucas-nguyen-17
  • 5,516
  • 2
  • 9
  • 20