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

feat(msw): allow mock delay override via function #945

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

andersonvom
Copy link
Contributor

Status

READY

Description

This adds the possibility to override MSW mocks with a dynamic delay using a function that returns a number, making API calls more similar to real-world ones, where responses can potentially come back at different times:

{
  // ... other options ...
  override: {
    mock: {
      delay: () => { ... }
    }
  }
}

This change is backwards compatible and the previous default value has been maintained.

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

This adds the possibility to override MSW mocks with a dynamic delay
using a function that returns a number, making API calls more similar to
real-world ones, where responses can potentially come back at different
times:

```js
{
  // ... other options ...
  override: {
    mock: {
      delay: () => { ... }
    }
  }
}
```

This change is backwards compatible and the previous default value has
been maintained.
@vercel
Copy link

vercel bot commented Sep 21, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @anymaniax on Vercel.

@anymaniax first needs to authorize it.

Copy link
Collaborator

@anymaniax anymaniax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good thanks!

@anymaniax anymaniax merged commit 993d227 into orval-labs:master Sep 28, 2023
2 checks passed
@andersonvom andersonvom deleted the allow-mock-delay-function branch September 28, 2023 14:14
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

Successfully merging this pull request may close these issues.

2 participants