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.explain should work on objects that contain test doubles #48

Open
searls opened this issue Nov 14, 2015 · 2 comments
Open

td.explain should work on objects that contain test doubles #48

searls opened this issue Nov 14, 2015 · 2 comments
Projects

Comments

@searls
Copy link
Member

searls commented Nov 14, 2015

If td.explain is passed an object, it should loop over the functions and, if any test double functions are found, should report some rollup stats (e.g. "my name is this, here are the test doubles, they have X many calls", etc)

Thanks @johnkpaul for the idea!

@robwold
Copy link
Contributor

robwold commented Dec 19, 2018

Hi,
I've been using testdouble all of 1 week, but I ran into this issue on day 1. (I'm enjoying using it though, so thanks for your hard work.) Having checked the source code for explain I'd be happy to submit a PR based on the approach quoted above:

  • test the typeof argument passed to explain;
  • if it's an object, check if each of its values is a test double function (or some nested object with a test double function in there somewhere);
  • produce a summary report by applying the existing method for explain to each test double in turn.

However, in the issues that reference this one, the discussion seems to take place at the level of the interaction between explain and "the store", which I wouldn't touch with this approach. So as I've not ventured far into the codebase, and this issue has been open a while, I thought I'd ask before I spent the time writing the code: is there a reason you'd prefer to avoid the rock-dumb approach suggested here, or is there some reason why it wouldn't work that I'm missing?

@searls
Copy link
Member Author

searls commented Dec 20, 2018

Hey @robwold thank you for the offer! To ensure your time is well spent, how about you send a PR with a quick and dirty proof of concept and then we can discuss that before figuring out how to best incorporate and test it (re: other design concerns)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
td.js 2.0
Backlog
Development

No branches or pull requests

2 participants