571fe5bc7c
- Create backend xUnit test project with Moq and FluentAssertions - Add test utilities: TestDataFactory, MockHttpContext, TestUserClaims - Create AuthControllerTests with comprehensive auth scenarios - Install Jest and React Testing Library for frontend - Configure jest.config.ts and jest.setup.ts with Next.js support - Add test scripts to package.json
2.2 KiB
2.2 KiB
ADDED Requirements
Requirement: Backend API integration tests exist
The system SHALL have integration tests for the backend API that verify endpoints work correctly with real or test database.
Scenario: API endpoint returns expected response
- WHEN an API endpoint is called via HTTP request
- THEN the response SHALL match expected status code and body structure
Scenario: API endpoint persists data
- WHEN a POST or PUT request is made
- THEN the data SHALL be persisted and retrievable via GET request
Scenario: API handles authentication
- WHEN a protected endpoint is called with or without valid authentication
- THEN the response SHALL enforce authentication rules correctly
Requirement: Frontend-backend integration tests exist
The system SHALL have tests that verify the frontend can communicate with the backend API.
Scenario: Frontend fetches data from backend
- WHEN the frontend makes an API call to the backend
- THEN the backend SHALL receive the request and return appropriate data
Scenario: Frontend sends data to backend
- WHEN the frontend submits form data to the backend
- THEN the backend SHALL process the data and return success or error response
Requirement: Test database is isolated
The system SHALL use an isolated test database for integration tests.
Scenario: Test database is separate from development database
- WHEN integration tests run
- THEN they SHALL connect to a test database, not the development database
Scenario: Test database is reset between test runs
- WHEN integration tests complete
- THEN the test database state SHALL be cleaned up to ensure test isolation
Requirement: Integration tests can run in CI
The system SHALL support running integration tests in CI environment with test infrastructure.
Scenario: Backend and database start for tests
- WHEN integration tests are executed in CI
- THEN the backend and test database SHALL start automatically before tests
Scenario: Tests use correct environment configuration
- WHEN tests run in CI environment
- THEN they SHALL use CI-specific configuration (test database URLs, test auth secrets)