mercredi 1 mars 2017

Postman JSON value check test fails

I have an API which has response as below:

"data": {
"catalog_list_items": [
  {
    "catalog_list_items": [
      {
        "catalog_list_items": [
          {
            "title": "L13",
            "content_id": "58a85146b0000ec",
            "sequence_no": 1,
            "language": "hindi",
            "genres": [
              "xxxx"
            ]

....... I would like to create a test in postman to verify that the language key has value as 'hindi'. I am writing below test in Postman which always fails. Cannot find the reason.

var jsonData = JSON.parse(responseBody); 

tests["Language is hindi"] = jsonData.data.catalog_list_items[3].language === "hindi";

However, when I use the similar structure to test sequence_no, it works fine

var jsonData = JSON.parse(responseBody);    

tests["Sequence No is 1"]= jsonData.data.catalog_list_items[3].sequence_no === 1;

Can anyone shed a light for me?

Thanks in advance..

Aucun commentaire:

Enregistrer un commentaire