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

Unexpected output with td.matchers.isA(Function) #307

Closed
codedbypaul opened this issue Dec 5, 2017 · 3 comments
Closed

Unexpected output with td.matchers.isA(Function) #307

codedbypaul opened this issue Dec 5, 2017 · 3 comments

Comments

@codedbypaul
Copy link

codedbypaul commented Dec 5, 2017

When I use:

td.verify(mockAdapter.registerInteractionHandler(td.matches.isA(Function)));

The output is:

Wanted:
  - called with `(isA(Function))`.

All calls of the test double, in order were:
  - called with `("change", function (evt) {
    return _this.handleChange_(evt);
  })`
fail
default

Am I misunderstanding how isA(Function) works?

The functions being used:

this.adapter_.registerInputInteractionHandler('change', this.groupChangeHandler_);
this.groupChangeHandler = (evt) => this.handleChange_(evt);
@codedbypaul codedbypaul changed the title Unexpected output with td.matchers.isA(FUN Unexpected output with td.matchers.isA(Function) Dec 5, 2017
@searls
Copy link
Member

searls commented Dec 5, 2017

Based on called with ("change", function (evt) { from the error message, it looks like the assertion is correct to fail, since the first argument is a string and not a function. Shouldn't the test be:

td.verify(mockAdapter.registerInteractionHandler("change", td.matchers.isA(Function)));

@searls searls closed this as completed Dec 5, 2017
@searls
Copy link
Member

searls commented Dec 5, 2017

(Will reopen if I have that wrong)

@codedbypaul
Copy link
Author

Ah yes that passes. Thanks for that.

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