Test should be pass if one of the values in the array matches the single value I get in response

This is my script:

 pm.test("blendmode is correct" , function () {
  let arr = ['multiply', 'darken', 'light'],
    replayStickerObject = pm.response.json();
  arr.forEach((x) => {
    pm.expect(replayStickerObject.data.actions[2].added_objects[0].blendmode).to.be.oneOf([x]);
  }); 
});

Requirement: I need to verify if one of the values in the array matches the single value of the response.
If one of [‘multiply’, ‘darken’, ‘light’] those 3 values matches the single value in response the test should be passed.

This is the response:

And here is the test result:


Any solution to this?
Thanks in advance

I don’t think you need the entire forEach block.

Try something like:
pm.expect(replayStickerObject.data.actions[2].added_objects[0].blendmode).to.be.oneOf(arr);

1 Like