Skip to content

How can I test it with multiple parameters with using test.each? #699

Discussion options

You must be logged in to vote

Sorry... I solved it with myself.

it.each`
id | expected
"someID1" | 200
"someID2" | 200
`("with some ids as parameters. id: $id, expected: $expected", async () => {
    await testApiHandler({
      handler: usersListHandler,
      test: async ({ fetch }) => {
          const response = await fetch({
            body: JSON.stringify({id})
          })
          const status = response.status
          expect(status).toBe(200)
        }
      },
    })
  })

Thanks!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Xunnamius
Comment options

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
2 participants