mardi 4 juillet 2017

How to partially check object with Jasmine

is there a way how to partially match object with array property? Let's suppose that I'd like to test this object


    {
       "groups": [
          {
             "id": 1,
             "name": "Group 1",
             "people": [
                {
                   "firstName": "John",
                   "age": 23
                },
                {
                   "firstName": "Ethan",
                   "age": 18
                }
             ]
          },
          {
             "id": 2,
             "name": "Group 2",
             "people": [
                {
                   "firstName": "Peter",
                   "age": 47
                },
                {
                   "firstName": "Henry",
                   "age": 55
                }
             ]
          }
       ]
    }

and ensure that it contains group with name Group 1 that contains John and Ethan. I'm aware of jasmine.objectContaining but I don't know how to apply to this particular case. Thank for any advice.

Aucun commentaire:

Enregistrer un commentaire