Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MockedEndpoint

A mocked endpoint provides methods to see the current state of a mock rule.

Hierarchy

  • MockedEndpoint

Implemented by

Index

Properties

id: string

Methods

  • Get the requests that this endpoint has seen so far.

    This method returns a promise, which resolves with the requests seen up until now, once all ongoing requests have terminated. The returned lists are immutable, so won't change if more requests arrive in future. Call getSeenRequests again later to get an updated list.

    Requests are included here once the response is completed, even if the request itself failed, the responses failed or exceptions are thrown elsewhere. To watch for errors or detailed response info, look at the various server.on(event) methods.

    Returns Promise<CompletedRequest[]>

  • isPending(): Promise<boolean>
  • Reports whether this endpoint is still pending: if it either hasn't seen the specified number of requests (if one was specified e.g. with .twice()) or if it hasn't seen at least one request, by default.

    This method returns a promise, which resolves with the result once all ongoing requests have terminated.

    Returns Promise<boolean>

Generated using TypeDoc