This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.
See most active contributors on hexlet-friends.
Jest plugin for testing HTTP status code.
npm i jest-supertest-matchers
import app from '../app';
import matchers from 'jest-supertest-matchers';
import request from 'supertest';
// inside tests
beforeAll(() => {
expect.extend(matchers);
});
it('example', async () => {
const res = await request(app).get('/');
expect(res).toHaveHTTPStatus(200);
});
$ make test