SMEDRECSMEDREC
Home
Get Started
AI Agents
Development Resources
Home
Get Started
AI Agents
Development Resources
  • Introduction

    • Get Started
  • AI Agents

    • FHIR Test Agent
    • Assistant Agent
    • Patient Report Agent
    • Scheduling Agent
  • Development

    • Development Resources
    • MCP FHIR Server Overview
    • Authentication and Authorization Flow (MCP Server)
    • FHIR Client (@repo/fhir)
    • MCP FHIR Tools
    • Security Considerations
    • Deployment and Configuration
  • Applications

    • API Application (apps/api)
    • Audit Worker (apps/audit)
  • Packages

    • Audit Package (@repo/audit)
    • @repo/auditdb
    • Mailer Package (@repo/mailer)
    • Cerbos Client (@repo/cerbos)
  • Databases

    • Transparent Field Encryption in PostgreSQL

Testing Strategy

Testing Overview

All tests follow the Vitest configuration with:

  • Unit tests in *.test.ts files
  • Integration tests in test/integration/ directories
  • E2E tests in apps/web/e2e/

Test Types

Unit Testing

  • Frontend: React Testing Library + Vitest (see apps/web/vitest.config.ts)
  • Backend: Vitest + Supertest for API endpoint validation
  • Coverage: 85%+ for core modules

Integration Testing

  • Database: Local PostgreSQL + pgvector for test environments
  • Worker: Cloudflare Worker test harness in apps/api/src/test/integration/worker.test.ts
  • API: End-to-end flow validation with real database connections

E2E Testing

  • Tool: Cypress 13.x with component testing
  • Coverage: Critical paths only (login, form submission, data export)
  • Execution: pnpm run e2e in apps/web/

CI/CD Integration

  • GitHub Actions:
    • Unit tests on PR
    • Integration tests on merge
    • E2E tests nightly
  • Thresholds:
    • Fail build if coverage <80%
    • Block deployment if critical tests fail

Mocks & Fixtures

  • Frontend:
    • Mock service workers in apps/web/src/mocks/
    • Storybook stories for component states
  • Backend:
    • apps/api/src/test/fixtures/ for database seeding
    • msw for API mocking

Reporting

  • Coverage: HTML reports in coverage/ directories
  • Allure: XML results in allure-results/ for detailed test analysis
  • Flaky Tests: Quarantined in apps/api/src/test/quarantine/
Last Updated: 6/17/25, 3:04 AM
Contributors: José Cordeiro