So I have two working environments, and a request that can be carried out on either. I have a test written that checks each response to see if a particular string is present - item A is only on environment A and item B is only on environment B
x.forEach(function(config) {
var shitems = (config.items);
if (shitems.includes("item_A" || "item_B"))
{
picked_sig = (config.signature);
titems = (config.items);
}});
console.log(titems);
console.log(picked_sig);
postman.setEnvironmentVariable("old", picked_sig);
For some reason if the first item isn’t present, the test fails, but if it is present, it passes. What I want my test to do is pass if either of those items is present. If I switch the order of the items on the environment that fails the test, it’ll then pass.
What am I doing wrong? Have I misunderstood how the “||” operator works?