Testing Conventions & Usage
Test Conventions
- Test files are named
*.spec.tsor*.spec.tsxand colocated with source files - Use descriptive test names that explain what is being tested
- Follow the Arrange-Act-Assert pattern
- Mock external dependencies to keep tests isolated and fast
- Use React Testing Library's
screenqueries for component tests - Avoid testing implementation details; focus on user-facing behavior
Running Tests
# Run all tests
nx run-many -t test
# Run tests for a specific project
nx test my-project
# Run tests in watch mode
nx test my-project --watch
# Run tests with coverage
nx test my-project --coverage