How to use `jest` to assert objects in these two arrays have the same id?

```
const array1 = [{id:1,name:'a'},{id:2,name:'b'}]
const array2 = [{id:1},{id:2,name:'b'}]

```

for now, I am using method like this I think it isn't good.

```
expect(_.map(array1, 'id')).toEqual(_.map(array2, 'id'));

```