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

Proposal: Add async API #21

Open
Sayan751 opened this issue Jan 27, 2025 · 0 comments
Open

Proposal: Add async API #21

Sayan751 opened this issue Jan 27, 2025 · 0 comments

Comments

@Sayan751
Copy link
Member

Currently, the API is exclusively synchronous. An asynchronous API would be easier when waiting for a particular state in tests.

  • await spy.isCalledAsync(methodName, [count], [timeout]);
  • await spy.isCalledWithAsync(methodName, argList, [options]);
    • argList can be either [arg_1, ..., arg_n] for a single call or [[arg_1_1, ..., arg_1_n], ..., [arg_m_1, ..., arg_m_n]] for multiple calls.
    • options can have the following properties:
      • orderInsensitive: when set to true then the order of the argList does not matter.
      • isSet: when set to true, then the argList is considered as a set.
      • index: when set, then the argList is matched against a particular invocation of the method, indicated by the given index.
      • timeout: if the assertion fails, when it cannot be resolved under the given timeout.
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

1 participant