Skip to content

control when suspending functions emit - is this possible? #287

Open
@ZakTaccardi

Description

@ZakTaccardi

AFAIK, there's no way to run an assertion after a suspending function is invoked but before it returns (resumes with a return value). Is this possible?

Currently, mocking suspending functions return immediately when invoked. I would like to control the timing of when they resume with a value. Is this possible? Use case for loading some async data is:

  1. suspending function is invoked (without returning yet)
  2. assert that loading indicator is shown
  3. allow previously invoked suspending function to resume with value
  4. assert that loading indicator is no longer shown

Does MockitoK have a way to do this?

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