Reputation: 3137
the expect returned values are the same but to test always fail, here the logged result
Error: expect(received).toContain(expected) // indexOf
Expected value: [72, 71]
Received array: [72, 71]
I will be gratefull for any explanation
Upvotes: 1
Views: 843
Reputation: 3137
In fact I just found a quick solution using a correct jest matcher
Before
expect(c.users.map((u) => u.id)).toContain([72, 71]);
After
expect(c.users.map((u) => u.id)).toEqual(expect.arrayContaining([72, 71]));
Upvotes: 2