Skip to content

Add backend test coverage suite and CI pipeline#98

Merged
SHUBHAM-2305 merged 4 commits into
mainfrom
test/backend-coverage-ci
May 27, 2026
Merged

Add backend test coverage suite and CI pipeline#98
SHUBHAM-2305 merged 4 commits into
mainfrom
test/backend-coverage-ci

Conversation

@Manmeetkaur06
Copy link
Copy Markdown
Collaborator

@Manmeetkaur06 Manmeetkaur06 commented May 27, 2026

Summary

This PR adds a backend test coverage suite and a GitHub Actions CI pipeline for the Guardian backend project.

The test suite covers the main implemented backend flows, including authentication, RBAC, admin dashboard, admin task management, admin patient reassignment, patient workflows, organisation and staff approval, notifications, AI signal/alert flows, health records, prescriptions, patient logs, care team dashboards, doctor workflows, and shared service/helper logic.

The CI pipeline automatically runs backend tests and validates the Docker build on pull requests.

Changes Made

  • Added structured Mocha/Chai backend tests under src/test/
  • Added shared test helpers for:
    • test app setup
    • database setup and cleanup
    • reusable fixtures
    • mock response utilities
  • Added NYC coverage configuration with .nycrc and .nycrc.json
  • Added package scripts for:
    • running tests
  • Added GitHub Actions workflow: Backend CI
  • CI now runs:
    • dependency installation using npm ci
    • automated backend tests
    • Docker image build validation

Coverage Result

Current local result:

  • 65 passing tests
  • 0 failing tests
  • Line coverage: approximately 79.24%
  • Function coverage: approximately 81.67%
  • Statement coverage: approximately 77.66%
  • Branch coverage: approximately 66.32%

This provides approximately 80% backend test coverage, which supports the project testing and CI/CD goal.

Test Evidence

image image

Tested locally with:

docker compose down -v
docker compose up -d mongo
npm run test:coverage

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
guardian-backend- Ready Ready Preview, Comment May 27, 2026 10:56pm

@Manmeetkaur06 Manmeetkaur06 marked this pull request as ready for review May 27, 2026 22:58
Copy link
Copy Markdown
Collaborator

@SHUBHAM-2305 SHUBHAM-2305 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good foundation for backend testing and CI. Since there were no proper automated tests before, this PR is an important first step toward improving reliability and regression testing. The current setup can be extended further with more unit, integration, and workflow-based tests as the backend grows.

Good work.

@SHUBHAM-2305 SHUBHAM-2305 merged commit ef0877a into main May 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants