diff --git a/index.js b/index.js index ed535bf..7aa18d5 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ app.use(express.json()); app.get("/", (req, res) => { res.json({ status: "OK", - message: "Home Route Working" + message: "Home Route Working Fine" }); }); @@ -19,6 +19,7 @@ app.get("/health", (req, res) => { module.exports = app; + // only start server if not testing // It ensures the server starts only when the file is run directly, not when it is imported for testing. if (require.main === module) { diff --git a/test.js b/test.js index f57ec65..0ce01af 100644 --- a/test.js +++ b/test.js @@ -15,7 +15,7 @@ describe("API Testing", () => { test("GET / should return status ok", async () => { const res = await request(app).get("/"); - expect(res.body.status).toBe("ok"); + expect(res.body.status).toBe("OK"); }); test("GET /health should return status OK", async () => {