docs: add e2e testing documentation
This commit is contained in:
parent
542c27bb51
commit
077f3b6a87
29
.github/README.md
vendored
29
.github/README.md
vendored
@ -2,6 +2,33 @@
|
||||
|
||||
This directory contains the CI/CD configuration for the project.
|
||||
|
||||
## Testing
|
||||
|
||||
The project includes end-to-end (e2e) tests to ensure the API endpoints work correctly. The tests are located in the `backend/test` directory.
|
||||
|
||||
### Running E2E Tests
|
||||
|
||||
```bash
|
||||
# Navigate to the backend directory
|
||||
cd backend
|
||||
|
||||
# Run e2e tests
|
||||
npm run test:e2e
|
||||
```
|
||||
|
||||
### Test Structure
|
||||
|
||||
- `app.e2e-spec.ts`: Tests the basic API endpoint (/api)
|
||||
- `auth.e2e-spec.ts`: Tests authentication endpoints including:
|
||||
- User profile retrieval
|
||||
- Token refresh
|
||||
- GitHub OAuth redirection
|
||||
- `test-utils.ts`: Utility functions for testing including:
|
||||
- Creating test applications
|
||||
- Creating test users
|
||||
- Generating authentication tokens
|
||||
- Cleaning up test data
|
||||
|
||||
## CI/CD Workflow
|
||||
|
||||
The CI/CD pipeline is configured using GitHub Actions and is defined in the `.github/workflows/ci-cd.yml` file. The workflow consists of the following steps:
|
||||
@ -72,4 +99,4 @@ For production deployment, consider the following:
|
||||
2. Set up proper networking and security groups
|
||||
3. Configure a reverse proxy (like Nginx) for SSL termination
|
||||
4. Set up monitoring and logging
|
||||
5. Configure database backups
|
||||
5. Configure database backups
|
||||
|
@ -95,6 +95,23 @@ $ pnpm run test:e2e
|
||||
$ pnpm run test:cov
|
||||
```
|
||||
|
||||
### End-to-End (E2E) Tests
|
||||
|
||||
The project includes comprehensive end-to-end tests to ensure API endpoints work correctly. These tests are located in the `test` directory:
|
||||
|
||||
- `app.e2e-spec.ts`: Tests the basic API endpoint (/api)
|
||||
- `auth.e2e-spec.ts`: Tests authentication endpoints including:
|
||||
- User profile retrieval
|
||||
- Token refresh
|
||||
- GitHub OAuth redirection
|
||||
- `test-utils.ts`: Utility functions for testing including:
|
||||
- Creating test applications
|
||||
- Creating test users
|
||||
- Generating authentication tokens
|
||||
- Cleaning up test data
|
||||
|
||||
The e2e tests use a real database connection and create/delete test data automatically, ensuring a clean test environment for each test run.
|
||||
|
||||
## Deployment
|
||||
|
||||
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
||||
|
Loading…
x
Reference in New Issue
Block a user