Skip to content

Top-level 'await' does not work #692

Discussion options

You must be logged in to vote

Sorry guys, I fixed it by myself by surrounding it function.

import { testApiHandler } from "next-test-api-route-handler"

import endpoint from "pages/api/interests/list"

const handler: typeof endpoint = endpoint

it("test sample", async () => {
  await testApiHandler({
    handler,
    test: async ({ fetch }) => {
      expect((await fetch()).status).toBe(200)
    },
  })
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KeisukeNagakawa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant