1const users = [{id: 1, name: 'Hugo'}, {id: 2, name: 'Francesco'}];
2
3test('we should have ids 1 and 2', () => {
4 expect(users).toEqual(
5 expect.arrayContaining([
6 expect.objectContaining({id: 1}),
7 expect.objectContaining({id: 2})
8 ])
9 );
10});
1const fruits = ['apple', 'cat'];
2
3test('should have array of string', () => {
4 expect(fruits).toEqual(
5 expect.arrayContaining([expect.any(String)])
6 );
7});