toEqual makes a deep equality comparison. Which means that when all the properties of the objects’ values are equal, the objects are considered to be equal.
As you said, you are using resource which adds a couple of properties to the objects in the array.
So this {id:12} becomes this {id:12, $then: function, $resolved: true} which are not equal. Id checking should be fine if you are just testing if you set the values properly.