See more
…it. You have to create a new copy of the object with the required changes. You can do that with the array accessor methods (not the mutator methods), Object.assign(), using a new empty object as the target, or the array or…
Object.assign()
It’s perfectly OK to mock and fake for integration tests.
In general, units are tested using only the public interface of the unit (aka “public API” or “surface area”). This is referred to as black box testing. Black box testing leads to less brittle tests, because th…