In given response snippet "parentName" type is sometimes null
or sometimes string
. How to check/write testcase to check the typeof string
as well as null
at a time.
tests["Verify parentName is string"] = typeof(jsonData.parentName) === "string" || null;
tests["Verify parentName is string"] = typeof(jsonData.parentName) === "string" || "null";
"demo": [
{
"id": 68214,
"specializationId": 286,
"name": "Radiology",
"parentName": null,
"primary": true
}
],
How to handle this kind of condition in postman (null & string).