Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Kata author here: indeed, "real" spy libraries might be more useful with a method like you propose, and that could very well have made for a better kata (albeit slightly more challenging). The requirement that this kata record all arguments in all positions and treat them as comparable was meant to be a minimalistic demonstration of the following concepts:

    • that spyOn returns new, separate spy functions
    • that each new spy maintains its own stateful, queryable history

    If I were rewriting this kata today, I might have tried to make the library more "realistic" in its API and capabilities. That being said, I suspect that anyone who can solve this kata as intended would also be able to solve for a method like you describe.