Skip to content

Add backend CI pipeline and core API test coverage#94

Closed
Manmeetkaur06 wants to merge 11 commits into
mainfrom
ci-backend-tests
Closed

Add backend CI pipeline and core API test coverage#94
Manmeetkaur06 wants to merge 11 commits into
mainfrom
ci-backend-tests

Conversation

@Manmeetkaur06
Copy link
Copy Markdown
Collaborator

@Manmeetkaur06 Manmeetkaur06 commented May 14, 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
    • running coverage
    • checking coverage thresholds
  • Added GitHub Actions workflow: Backend CI
  • CI now runs:
    • dependency installation using npm ci
    • automated backend tests
    • coverage threshold check
    • 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 14, 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 24, 2026 11:42pm

Manmeetkaur06 added 2 commits May 18, 2026 17:03
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.

1 participant