Skip to content

Mock method "returns" implementation is called twice #40

Closed
@maghis

Description

I'm mocking a method that returns a Promise:

myMock.setup(x => x.method()).returns(() => Promise.reject(new Error("blah")));

I noticed that the "returns" implementation is executed twice even if "method" is called only once on the mock.
This should not be a problem normally, the issue is that in this particular case, the test runner is failing because it detects an unhandled promise rejection.

Is this a known behavior?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions