docs: add e2e testing documentation

This commit is contained in:
Mathis HERRIOT 2025-05-16 19:05:55 +02:00
parent 542c27bb51
commit 077f3b6a87
No known key found for this signature in database
GPG Key ID: E7EB4A211D8D4907
2 changed files with 45 additions and 1 deletions

27
.github/README.md vendored
View File

@ -2,6 +2,33 @@
This directory contains the CI/CD configuration for the project. 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 ## 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: 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:

View File

@ -95,6 +95,23 @@ $ pnpm run test:e2e
$ pnpm run test:cov $ 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 ## 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. 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.