pm.expect(pm.response.json().email).to.eql(pm.variables.get("email_address"))
the email address in the env variable will be added either with caps or no caps, is there a way I can force the pm.expect to ignore upper or lower case?
pm.expect(pm.response.json().email).to.eql(pm.variables.get("email_address"))
the email address in the env variable will be added either with caps or no caps, is there a way I can force the pm.expect to ignore upper or lower case?
Hi @thingmie
Try this;
let text = "HeLlO WoRlD!";
console.log(text);
let result = text.toLowerCase();
console.log(result);
Output;
response.emailAddress is my example… you would need to change this to the nested structure of your JSON…
Looking at your original post your JSON would be;
response.email
But I wouldn’t be able to confirm this unless your shared your response body.
It would fail as you have only instructed the code to change the response value to lower case, not your environment variable.
if you want both to be set as lower case you would have to change your assertion to;
pm.expect(email).to.eql(pm.environment.get("email_address").toLowerCase());
Looks ok to me.
Does it pass?
yeah, but I’m not sure how to mock the _id and email_verified values to prove it.
What do you mean by “mock the _id and email_verified values”?
These are in your response, right?
If you want to see the values of those properties then just console log it.
I wondered if i could change the values during runtime so i can test the logic; and yes they’re in the response.