Hi,
I’m the following test to check my json response is structured correctly.
How can I check that the property ‘field_apply_url’ returns as either null or a string? I’m struggling to find a way how to do it.
const jsonData = pm.response.json();
pm.test("Apprenticeship details response is structured correctly", () => {
pm.expect(jsonData).to.be.an("object");
pm.expect(jsonData).to.have.property('nid').to.be.a('string');
pm.expect(jsonData).to.have.property('field_apply_url').to.be.a('string');
/or/
pm.expect(jsonData).to.have.property('field_apply_url').to.be.null;
})
Thanks
Chris