fragments / tests / unit / app.test.js
app.test.js
Raw
const request = require('supertest');

const app = require('../../src/app');

describe('/ 404 handler check', () => {
	test('should return HTTP 404 response', async () => {
		const res = await request(app).get('/error');
		expect(res.statusCode).toBe(404);
		expect(res.body.status).toBe('error');
		expect(res.body.error.message).toBe('not found');
		expect(res.body.error.code).toBe(404);
	});
});