Bugfix: Fix merge behavior of arrays
Fixes a bug where building a factory with an empty array was not overriding a non-empty array if it was defined that way in a factory:
const elementsFactory = Factory.define<Elements>(() => ({
elements: ["STRING"],
}));
elementsFactory.build({ elements: [] }));
// { elements: ["STRING"] }
Now, when passing an array to myFactory.build()
, that array fully overrides the object defined in the factory. There is no partial/deep merging of arrays. The typing of params
in the factory now also reflect this. This should not be an issue for most users, as the existing merging of arrays was not documented and did not behave as most would expect.
See #38 for more information.