HTTP Test Client
Make HTTP requests to your app in tests.
1 min readEdit this page
Usage
import { createTestClient } from '@restjs/testing'
const client = createTestClient(app)
const res = await client.get('/users')
const res = await client.post('/users').send({ name: 'Tariq' })
const res = await client.get('/profile').auth(token)
const res = await client.get('/data').set('X-Custom', 'value')
expect(res.status).toBe(200)
expect(res.body.data).toHaveLength(3)