Testing

HTTP Test Client

Make HTTP requests to your app in tests.

1 min readDocumentationEdit this page

Usage#

typescript
import { createTestClient } from '@AxilJS/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)

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY