This PR addresses issue #91 by implementing a robust, multi-layer automated testing framework. It establishes a testing pyramid strategy including unit, integration, security, and contract tests, orchestrated via a new GitHub Actions workflow.
- Jest & TS-Jest: Configured as the primary test runner with TypeScript support.
- Axios Client: Created a standardized
ApiClientfor consistent HTTP interactions with microservices. - Reporters: Integrated
jest-html-reporterandjest-junitfor detailed visual and CI-compatible reports.
- Unit Tests: Isolated logic testing (mocking dependencies).
- Integration Tests: Verifying service-to-service communication and database interactions (e.g.,
Authentication.test.ts). - Security Tests: Automated vulnerability scanning and auth bypass checks.
- Contract Tests: Ensuring microservice API compatibility.
- Created
.github/workflows/comprehensive-test.ymlwhich:- Spins up ephemeral PostgreSQL and Redis containers.
- Installs dependencies and sets up the test environment.
- Executes the full test suite in order (Unit -> Integration -> Security -> Contract).
- Generates and uploads test artifacts.
- Code Quality: Enforces high standards and prevents regressions.
- Reliability: Catches integration issues before deployment.
- Security: Proactively identifies vulnerabilities in the pipeline.
- Velocity: Enables faster refactoring and feature development with confidence.
- Run
cd api-testing && npm install. - Run
npm run test:integrationto verify the authentication flow. - Check the
test-reports/directory for the HTML report.
Closes #91