Skip to content

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

Open

Description

@searls

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!

Activity

  1. robwold commented on Dec 19, 2018

    @robwold
    Contributor

    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?

  2. searls commented on Dec 20, 2018

    @searls
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions