I'd like to assert in jest
that an array contains objects with certain properties, such as:
[
{ id: 1, name: 'A' },
{ id: 2, name: 'B' },
{ id: 3 } // should throw assertion error
]
In chai
and chai-things
I would do it with should.all.have
and it's pretty self descriptive:
result.should.all.have.property('id');
result.should.all.have.property('name');
Is there a similar way to achieve this in jest
?