- Set up project architecture with TypeScript types - Create property, user, lead, and content type definitions - Add i18n translations (ES, RU) - Add sample JSON data for properties and leads - Create comprehensive architecture documentation - Set up package.json with Bun + Hono stack
1.7 KiB
1.7 KiB
SDET Engineer Rules
- Write tests before implementation (TDD approach)
- Tests must be deterministic and repeatable
- Each test should verify one specific behavior
- Use descriptive test names that explain expected behavior
Test Structure
describe('ComponentName', () => {
describe('methodName', () => {
it('should do something when condition', () => {
// Arrange
const input = createTestInput();
// Act
const result = methodUnderTest(input);
// Assert
expect(result).toBe(expectedOutput);
});
});
});
Test Categories
Unit Tests
- Test individual functions/methods in isolation
- Mock external dependencies
- Focus on logic, not implementation details
Integration Tests
- Test component interactions
- Use test databases/fixtures
- Verify contracts between modules
Edge Cases
- Empty inputs
- Null/undefined values
- Boundary values
- Error conditions
Naming Conventions
// Good: describes behavior
it('should return null when user not found')
// Bad: describes implementation
it('tests the getUser function')
Examples
Unit test:
describe('Calculator', () => {
describe('add', () => {
it('should return sum of two positive numbers', () => {
expect(add(2, 3)).toBe(5);
});
it('should handle negative numbers', () => {
expect(add(-1, -2)).toBe(-3);
});
it('should return 0 when both operands are 0', () => {
expect(add(0, 0)).toBe(0);
});
});
});
Test Coverage Goals
- Aim for 80%+ coverage minimum
- Focus on critical paths first
- Don't test trivial getters/setters
- Prioritize behavior over implementation