Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

td.object(['one', 'two']) syntax creates array-like object #370

Closed
Schoonology opened this issue May 16, 2018 · 2 comments
Closed

td.object(['one', 'two']) syntax creates array-like object #370

Schoonology opened this issue May 16, 2018 · 2 comments

Comments

@Schoonology
Copy link
Contributor

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]
@searls
Copy link
Member

searls commented May 17, 2018

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

@giltayar
Copy link
Collaborator

Stale. Closing. Please reopen if still relevant and I will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

3 participants