How to write correct test - If I want to expect response to include PART oneOf text

Hi,
Couldn’t find any similar post either which I could use.
I want to add a tests to check whether a PART (1 out of 2 ) of value is present in response
For example if response CONTAIN text “0” OR “1” - > I want test to be PASS.

For me working -

  1. pm.test(“Status code is 200”, function () {
    pm.expect(pm.response.code).to.be.oneOf([200, 201]);
    }); - in this case Postman checking if response EQUALS 1 out of 2 my expecting value. It pass if I get 200 or 201 status code

  2. pm.test(“Error_num matches”, function () {
    pm.expect(pm.response.text()).to.include(“0”); - in this case Postman checking if response CONTAIN “0”, if yes → Pass

But I need combine this conditions.
I need Test to be PASS if response CONTAIN first OR second textExpectingResult
I tried already this, and its not working

  1. pm.expect(pm.response.text()).to.include(pm.variables.get(“Error_num”));
    pm.expect(pm.response.text()).to.be.oneOf([(“1”), (“1”)]); //with or without (), using to.include or to.includes
  2. pm.test(“Error_num matches”, function () {
    pm.expect((pm.response.text()).to.include(“0”) || (pm.response.text()).to.include(“1”)).to.be.true; //or without .to.be.true
  3. and a lot of other not working combinations.

Please help me to resolve my problem.

Thanks! I got it

let responseJson = xml2Json(responseBody);

if (pm.test(“Error_num matches”, function () {
pm.expect(responseJson.postresponse).to.have.property(‘errornum’).and.to.be.oneOf([‘994’, ‘1’]);
}));
and its working!