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

Verify that constructor is passed certain values #256

Closed
lastmjs opened this issue Jun 6, 2017 · 1 comment
Closed

Verify that constructor is passed certain values #256

lastmjs opened this issue Jun 6, 2017 · 1 comment

Comments

@lastmjs
Copy link

lastmjs commented Jun 6, 2017

I would like to verify that a constructor was called with certain parameters, just like I would verify a function call. How can I do that? I was imagining something like:

const MockConstructor = td.constructor(require('some-constructor'));

new MockConstructor({
  option1: true,
  option2: false
});

td.verify(new MockConstructor({
  option1: true,
  option2: false
}));
@searls
Copy link
Member

searls commented Jun 6, 2017

Yes, and this works.

https://runkit.com/searls/testdouble-js-256

@searls searls closed this as completed Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants