testdouble.js
testdouble.js copied to clipboard
td.object(['one', 'two']) syntax creates array-like object
trafficstars
Surprisingly, td.object({ something() {} }) and td.object(['something']) produce different results; the latter is an Array.
> td.object({ something() {} }).splice
undefined
> td.object(['something']).splice
[Function: splice]
Huh. That seems pretty wrong. Looks like it's a side effect of the (out-of-context, odd) decision to use _.transform to create the return object when passed an array of names:
https://github.com/testdouble/testdouble.js/blob/master/src/object.js#L29-L31
Stale. Closing. Please reopen if still relevant and I will look into it.