mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
23 lines
740 B
TypeScript
23 lines
740 B
TypeScript
import * as testDb from './shared/test-db';
|
|
import { setupTestServer } from '@test-integration/utils';
|
|
|
|
const testServer = setupTestServer({ endpointGroups: ['health'] });
|
|
|
|
describe('HealthcheckController', () => {
|
|
it('should return ok when DB is connected and migrated', async () => {
|
|
const response = await testServer.restlessAgent.get('/healthz/readiness');
|
|
|
|
expect(response.statusCode).toBe(200);
|
|
expect(response.body).toEqual({ status: 'ok' });
|
|
});
|
|
|
|
it('should return error when DB is not connected', async () => {
|
|
await testDb.terminate();
|
|
|
|
const response = await testServer.restlessAgent.get('/healthz/readiness');
|
|
|
|
expect(response.statusCode).toBe(503);
|
|
expect(response.body).toEqual({ status: 'error' });
|
|
});
|
|
});
|