mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
24 lines
747 B
TypeScript
24 lines
747 B
TypeScript
import { testDb } from '@n8n/backend-test-utils';
|
|
|
|
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' });
|
|
});
|
|
});
|