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

Make the constructor property of td.replaced() instantiable types useful #121

Closed
searls opened this issue Jul 21, 2016 · 3 comments
Closed

Comments

@searls
Copy link
Member

searls commented Jul 21, 2016

Right now if you use td.replace on an instantiable function, what gets returned includes a constructor property, but it's not actually able to be used to stub/verify calls to new Thing() in the subject.

This was an oversight on my part because I hadn't thought of it, and I'm not quite sure what to do about it.

h/t @appleton via twitter

@alexblom
Copy link

This would be really useful for me. In my case, I'm creating non-external objects with new Object({params}), and where passing the correct params is very important. I'm unsure how to test this behaviour with testdouble today.

As an example, in a larger function you will see:

    validatePlugin = new ValidatePluginTask({
      project: this.project,
      ui: this.ui,
      platform: platform,
      pluginName: 'cordova-plugin-whitelist'
    });

I really care that nobody forgot to pass pluginName, and that value of pluginName matches expectations.

@searls
Copy link
Member Author

searls commented Aug 12, 2016

Right on @alexblom -- I think this is important as well, and you have a very valid point. Unfortunately, I'm slammed with talk prep and travel the next month or two and don't want to commit to doing this myself soon.

@searls searls removed the question label Aug 12, 2016
@searls searls added this to the Round out edge cases milestone Aug 12, 2016
@searls
Copy link
Member Author

searls commented Dec 14, 2016

This will be fixed as an acceptance criteria of #166, so I'm closing it here

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

No branches or pull requests

2 participants