0
"thing": [
            {
                "id": 1,
            }
         ]

How do I assert that thing is an array with an object that contains ID

I tried

expect(response.thing).to.deep.include('id');

But that doesn't work

bezzoon
  • 1,755
  • 4
  • 24
  • 52

1 Answers1

1

If you want to check:

  • the array contains String id

pm.expect(JSON.stringify(response.thing)).to.deep.include('id');

  • a nested object has key id

pm.expect(response.thing[0]).to.have.keys('id');

lucas-nguyen-17
  • 5,516
  • 2
  • 9
  • 20