- Convert test/app.test.js from CommonJS to ES6 import/export - Export app from index.js for testing - Only start server if NODE_ENV !== 'test' - Fixes 'require is not defined' error in tests
10 lines
253 B
JavaScript
10 lines
253 B
JavaScript
import request from 'supertest';
|
|
import app from '../index.js';
|
|
|
|
describe('Test API health', () => {
|
|
it('GET /health doit répondre 200', async () => {
|
|
const res = await request(app).get('/health');
|
|
expect(res.statusCode).toBe(200);
|
|
});
|
|
});
|