As a response, I have an array returned with lots of email data and I want to verify that the emails returned in the response, are only from specific domains.
Not to verify the full emails themselves but only the domains are matching an “allowed domains list” (in the example given they will be somedomain and somedomain2 only).
Please, any ideas are welcome.
Example structure of response:
[
{
"id": "xxxx111122223333",
"firstName": "firstName",
"lastName": "",
"email": "[email protected]",
"replyToAddress": null,
"phoneNumber": null,
"internalUser": true,
"status": "Active",
"userStatus": {
"id": "statusId",
"name": "Active",
},
{
"id": "xxxx4444445555555",
"firstName": "firstName2",
"lastName": "",
"email": "[email protected]",
"replyToAddress": null,
"phoneNumber": null,
"internalUser": false,
"status": "Active",
"userStatus": {
"id": "statusId",
"name": "Active",
},
{
"id": "xxxx66667777777",
"firstName": "firstName3",
"lastName": "",
"email": "[email protected]",
"replyToAddress": null,
"phoneNumber": null,
"internalUser": false,
"status": "Active",
"userStatus": {
"id": "statusId",
"name": "Active",
},
]
I’ve already tried using oneOf but got some errors that I should use strings, which I am actually using.
Tried also to.include but then test will always pass while I am actually trying to confirm that there are no other domains different from the allowed list.