diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 1d980f3..08d61fd 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -31,6 +31,7 @@ jobs: DB_USERNAME: ${{ secrets.DB_USERNAME }} DB_PASSWORD: ${{ secrets.DB_PASSWORD }} DB_HOSTNAME: ${{ secrets.DB_HOSTNAME }} + SECRET: 0 # ****End to end Testing***** # # - name: e2e tests # uses: cypress-io/github-action@v2 @@ -39,7 +40,7 @@ jobs: # start: npm run start-prod # wait-on: http://localhost:5000 - name: Deploy - if: ${{ github.base_ref == 'main' }} + if: ${{ github.ref == 'main' }} uses: akhileshns/heroku-deploy@v3.12.12 # This is the action with: heroku_api_key: ${{secrets.HEROKU_API_KEY}} @@ -47,11 +48,9 @@ jobs: heroku_email: "youneslamkhanter02@gmail.com" # healthcheck: "law-firm-management-sys.herokuapp.com/version" # checkString: "1.1.0" - - name: Bump version and push tag - if: ${{ github.base_ref == 'main' }} + if: ${{ github.ref == 'main' }} uses: anothrNick/github-tag-action@1.33.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WITH_V: true - diff --git a/server/routes/api.js b/server/routes/api.js index e4cee3c..e873ff7 100644 --- a/server/routes/api.js +++ b/server/routes/api.js @@ -9,7 +9,7 @@ api.use("/api/cases", middleware.userAuthentication, caseRouter); api.use("/api/users", userRouter); api.use("/api/login", loginRouter); api.get("/health", (req, res) => { - res.send("v0.1.0"); + res.status(200).send("v0.1.0"); }); module.exports = api; diff --git a/server/tests/cases/case_api.test.js b/server/tests/cases/case_api.test.js index 75f2784..271b0ea 100644 --- a/server/tests/cases/case_api.test.js +++ b/server/tests/cases/case_api.test.js @@ -17,6 +17,12 @@ beforeAll(async () => { await Case.create({ ...helper.cases }); }); +describe("Health check", () => { + test("should return 200 OK", async () => { + await request(app).get("/v1/health").expect(200); + }); +}); + describe("GET /v1/api/cases", () => { test("should return all cases", async () => { const logedInUser = await request(app)