Skip to content

Verifying stubs that return promises without warnings? #245

@christav

Description

@christav

If I'm stubbing out a function that returns a promise, I need to set it up with a td.when. Then I usually do a td.verify to check that it's getting passed the right stuff.

When I call td.verify I get the warning print about "both stubbed and verified".

In this case I don't actually care about the stub or the return value, I just need it to return a promise (of null) instead of just null.

Would it be possible to define a helper or a flag or something so that when you do a td.func you can tell it it's an async function and return a promise for null by default instead of just null? Then we can td.verify without warnings, just in an async context.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions