Skip to content
This repository was archived by the owner on Aug 24, 2023. It is now read-only.
This repository was archived by the owner on Aug 24, 2023. It is now read-only.

Feature request: expect how many times a request has been made #21

@rickschubert

Description

@rickschubert

Currently, we can only check IF a request has been made using expectRequestToHaveBeenMade and expectRequestNotToHaveBeenMade. From internal statistics at trayio, these two methods are by far the most popular ones in the library.

Extending on this I think it would be nice to be able to expect how often a request was made. I suggest the following API:

const loginRequest = mockRequest({
    requestPattern: "https://www.example.com/login",
    requestMethod: "POST",
    responseBody: "hereGoesMyAuthToken",
    persistent: true
})
loginRequest.expectRequestToHaveBeenMadeTimes(8)

The particularity of this is that this would currently only work if persistent: true is used. Otherwise, the mock response will only take effect one single time when the request is made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions