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

Use MSW for API mocking in tests #125

Open
1 of 6 tasks
eric-burel opened this issue Sep 6, 2021 · 2 comments
Open
1 of 6 tasks

Use MSW for API mocking in tests #125

eric-burel opened this issue Sep 6, 2021 · 2 comments
Assignees
Labels

Comments

@eric-burel
Copy link
Collaborator

eric-burel commented Sep 6, 2021

Is your feature request related to a problem? Please describe.
Mocking graphql queries is annoying, and we use specific solution.

Describe the solution you'd like
Use the same lib for all frontend request mocks.

  • Drafted a first example in Storybook, for the SmartForm (FormContainer) in Vulcan NPM
  • Check that preview.js still loads correctly in Jest after adding msw
  • Extend install to Jest, by creating a server on startup
  • Cleanup reusable helper (declarative mocks to MSW mocks)
  • Add MSW to Cypress? We already have cy.intercept but MSW might be used to intercept ssr requests as well
  • Add MSW in both Vulcan Next and Vulcan NPM

Describe alternatives you've considered
Apollo Mock Client: not bad.
But MSW seems to become the standard for both Rest and graphql, because it catches calls at a lower level: https://mswjs.io/docs/getting-started/mocks/graphql-api

Additional context
Testing with Next discussion: vercel/next.js#28173 (comment)

@eric-burel eric-burel added the enhancement New feature or request label Sep 27, 2021
@eric-burel
Copy link
Collaborator Author

@eric-burel
Copy link
Collaborator Author

Done for Vulcan NPM, needs to be copied over Vulcan Next

@eric-burel eric-burel added the easy / good first issue Good for newcomers label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant