Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Modify healthcheck.test

Tuan Dangdb48ab8f6c81
diff --git a/backend/__tests__/healthcheck.test.ts b/backend/__tests__/healthcheck.test.ts
index 234d2d8ebc..9459684374 100644
--- a/backend/__tests__/healthcheck.test.ts
+++ b/backend/__tests__/healthcheck.test.ts
@@ -1,11 +1,16 @@
-import { server } from '../src/app';
+import { Server } from 'http';
+import main from '../src';
import { describe, expect, it, beforeAll, afterAll } from '@jest/globals';
import supertest from 'supertest';
import { setUpHealthEndpoint } from '../src/services/health';
-const requestWithSupertest = supertest(server);
+let requestWithSupertest: supertest.SuperTest<supertest.Test>;
+let server: Server;
+
describe('Healthcheck endpoint', () => {
beforeAll(async () => {
+ server = await main;
+ requestWithSupertest = supertest(server);
setUpHealthEndpoint(server);
});
afterAll(async () => {
@@ -16,4 +21,4 @@ describe('Healthcheck endpoint', () => {
const res = await requestWithSupertest.get('/healthcheck');
expect(res.status).toEqual(200);
});
-});
+});
\ No newline at end of file
diff --git a/backend/src/index.ts b/backend/src/index.ts
index 52740358db..90589404d2 100644
--- a/backend/src/index.ts
+++ b/backend/src/index.ts
@@ -169,6 +169,7 @@ const main = async () => {
});
setUpHealthEndpoint(server);
+ return server;
}
-main();
\ No newline at end of file
+export default main();
\ No newline at end of file