Skip to content

Testing API Routes #2942

Answered by beerose
ebeigarts asked this question in General
Discussion options

You must be logged in to vote

Hey @ebeigarts! Thanks for this and thanks for describing the APIs! It looks good — could you open a PR for that?

One thing we could change is removing the Api from the name: createApiResponseMock -> createResponseMock.
Things to do:

  1. Put the code in nextjs/packages/next/test-utils/index.ts.
  2. Add a new entry point called test-utils to the next package: https://github.com/blitz-js/blitz/blob/canary/nextjs/packages/next/ (You can take a look at stdlib as an example).
    1. Create a new test-utils.js file with export.
    2. Create a new test-utils.d.ts file with declaration exports.
    3. Add those files to the package.json to the files array.
    4. Add test-utils to taskfile.js — you can find mentions of stdlib an…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by beerose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants