Build comprehensive API tests using Mocha and Chai for Node.js backends
Create a complete Mocha/Chai test suite for a Node.js API:
**API Framework:** {{FRAMEWORK}} (Express/Fastify/Koa/NestJS)
**Base Path:** {{BASE_PATH}}
**Endpoints to Test:**
```
{{ENDPOINTS}}
```
**Authentication:** {{AUTH_TYPE}}
**Test Structure:**
1. **Unit Tests:**
- Controller functions
- Service layer logic
- Utility functions
- Middleware
2. **Integration Tests:**
- Full request/response cycle
- Database operations
- External service calls
3. **Test Categories per Endpoint:**
- Valid requests (2xx responses)
- Validation errors (400)
- Authentication failures (401)
- Authorization failures (403)
- Not found scenarios (404)
- Server errors (500)
**Generate:**
- Test file structure
- Setup/teardown hooks
- Test database seeding
- Supertest configuration
- Mocking with Sinon
- Coverage configurationOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{FRAMEWORK][{BASE_PATH][{ENDPOINTS][{AUTH_TYPE]