This document provides a quick reference for running tests in the Revora Backend project.
# Install dependencies
npm install
# Run all tests
npm test
# Run with coverage
npm run test:coverageLocation: src/__tests__/e2e-happy-path.test.ts
Comprehensive tests covering:
- ✅ User registration and authentication (investor, startup)
- ✅ Offering creation and management
- ✅ Investment creation and retrieval
- ✅ Complete user journeys
- ✅ Edge cases and boundary conditions
- ✅ Security validation
- ✅ Session management
- ✅ JWT token management
31 test cases with 95%+ coverage
Location: Various *.test.ts files throughout the codebase
src/auth/login/loginRoute.test.ts- Login flow testssrc/auth/register/registerHandler.test.ts- Registration testssrc/routes/health.test.ts- Health check testssrc/routes/offerings.test.ts- Offering route testssrc/routes/investments.test.ts- Investment route tests- And many more...
# Run all tests
npm test
# Run specific test file
npm test -- e2e-happy-path
# Run tests in watch mode
npm run test:watch
# Run with coverage report
npm run test:coverage
# Run E2E tests only
npm run test:e2e- Statements: 95%
- Branches: 95%
- Functions: 95%
- Lines: 95%
# Generate coverage report
npm run test:coverage
# Open HTML report (macOS/Linux)
open coverage/index.html
# Open HTML report (Windows)
start coverage/index.htmlBefore committing code:
- ✅ Run tests:
npm test - ✅ Check coverage:
npm run test:coverage - ✅ Run linter:
npm run lint - ✅ Build TypeScript:
npm run build
For detailed information about the E2E test suite, see:
# Clear Jest cache
npm test -- --clearCache
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install# Generate detailed coverage report
npm run test:coverage
# Open HTML report to see uncovered lines
open coverage/index.html# Check TypeScript compilation
npm run build
# Check specific file
npx tsc --noEmit src/path/to/file.tsTests are automatically run in CI/CD pipelines:
# Example GitHub Actions
- run: npm ci
- run: npm test -- --coverage
- run: npm run lint
- run: npm run buildWhen adding new features:
- Write tests for happy path
- Write tests for edge cases
- Write tests for error scenarios
- Ensure coverage remains above 95%
- Update documentation
Last Updated: 2024-01-01
Maintained By: Backend Team