Skip to content

Commit f9ec02c

Browse files
rmzlbclaude
andcommitted
style: Fix formatting in jest.config.js and TESTING.md
- Applied Prettier formatting to all files - Ensures consistent code style across the project 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3ca7fd1 commit f9ec02c

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

TESTING.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Testing Strategy
22

33
## Overview
4+
45
This project follows a pragmatic testing approach that balances code quality with development velocity.
56

67
## Current Coverage Status
8+
79
- **Overall**: ~16% coverage
810
- **Critical Path** (optimizer.ts): ~90% coverage ✅
911
- **Hooks**: ~97% coverage ✅
@@ -12,49 +14,58 @@ This project follows a pragmatic testing approach that balances code quality wit
1214
## Testing Philosophy
1315

1416
### 1. Progressive Coverage
17+
1518
- Start with realistic thresholds (current: 13-16%)
1619
- Gradually increase as the codebase matures
1720
- Target: 50% overall coverage by v2.0
1821

1922
### 2. Priority-Based Testing
23+
2024
**High Priority** (Must have tests):
25+
2126
- Business logic (optimizers, algorithms)
2227
- Data transformations
2328
- Utility functions
2429
- Custom hooks
2530

2631
**Medium Priority** (Nice to have):
32+
2733
- Complex UI components
2834
- API integrations
2935
- State management
3036

3137
**Low Priority** (Can rely on manual/E2E):
38+
3239
- Simple UI components
3340
- Static pages
3441
- Style-only components
3542

3643
### 3. Test Types
3744

3845
#### Unit Tests (Current Focus)
46+
3947
```bash
4048
npm test # Run all tests
4149
npm test -- --coverage # With coverage report
4250
npm test -- --watch # Watch mode for TDD
4351
```
4452

4553
#### Integration Tests (Future)
54+
4655
- Test complete user flows
4756
- Verify optimizer outputs with real data
4857
- API endpoint testing
4958

5059
#### E2E Tests (Future)
60+
5161
- Critical user journeys
5262
- Cross-browser compatibility
5363
- Performance benchmarks
5464

5565
## Coverage Thresholds
5666

5767
### Global Thresholds
68+
5869
```javascript
5970
{
6071
branches: 13, // Goal: 50%
@@ -65,35 +76,41 @@ npm test -- --watch # Watch mode for TDD
6576
```
6677

6778
### Critical Files
79+
6880
- `lib/optimizer.ts`: 85%+ coverage required
6981
- `lib/hooks/*.ts`: 95%+ coverage required
7082
- New utility functions: 80%+ coverage expected
7183

7284
## Adding Tests
7385

7486
### For New Features
87+
7588
1. Write tests BEFORE implementation (TDD)
7689
2. Ensure critical paths have tests
7790
3. Add integration tests for complex features
7891

7992
### For Bug Fixes
93+
8094
1. Write a failing test that reproduces the bug
8195
2. Fix the bug
8296
3. Ensure test passes
8397

8498
### For UI Components
99+
85100
1. Focus on behavior, not implementation
86101
2. Test user interactions
87102
3. Verify accessibility
88103

89104
## CI/CD Integration
90105

91106
Tests run automatically on:
107+
92108
- Every push to main
93109
- All pull requests
94110
- Pre-deployment checks
95111

96112
### Handling Test Failures
113+
97114
1. **Coverage below threshold**: Add tests or adjust thresholds with justification
98115
2. **Test failures**: Fix immediately, don't skip tests
99116
3. **Flaky tests**: Investigate root cause, don't ignore
@@ -114,10 +131,10 @@ describe('ComponentName', () => {
114131
it('should behave in expected way', () => {
115132
// Arrange
116133
const input = setupTestData()
117-
134+
118135
// Act
119136
const result = functionUnderTest(input)
120-
137+
121138
// Assert
122139
expect(result).toMatchExpectedOutput()
123140
})
@@ -128,28 +145,33 @@ describe('ComponentName', () => {
128145
## Roadmap
129146

130147
### Phase 1 (Current)
148+
131149
- [x] Basic unit tests for core logic
132150
- [x] Coverage reporting setup
133151
- [x] CI/CD integration
134152

135153
### Phase 2 (Q2 2025)
154+
136155
- [ ] Increase coverage to 30%
137156
- [ ] Add integration tests
138157
- [ ] Component testing with React Testing Library
139158

140159
### Phase 3 (Q3 2025)
160+
141161
- [ ] E2E tests with Playwright
142162
- [ ] Performance benchmarks
143163
- [ ] Visual regression tests
144164

145165
### Phase 4 (Q4 2025)
166+
146167
- [ ] 50% coverage target
147168
- [ ] Automated accessibility tests
148169
- [ ] Load testing for optimizer
149170

150171
## Contributing
151172

152173
When contributing, please:
174+
153175
1. Include tests for new features
154176
2. Maintain or improve coverage
155177
3. Run tests locally before pushing
@@ -159,4 +181,4 @@ When contributing, please:
159181

160182
- [Jest Documentation](https://jestjs.io/docs/getting-started)
161183
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/)
162-
- [Testing Best Practices](https://github.com/goldbergyoni/javascript-testing-best-practices)
184+
- [Testing Best Practices](https://github.com/goldbergyoni/javascript-testing-best-practices)

jest.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const customJestConfig = {
3131
// - UI components can be tested with integration/e2e tests
3232
coverageThreshold: {
3333
global: {
34-
branches: 13, // Current: 13.81% → Goal: 50%
35-
functions: 11, // Current: 11.86% → Goal: 40%
36-
lines: 16, // Current: 16.14% → Goal: 50%
37-
statements: 16, // Current: 16.08% → Goal: 50%
34+
branches: 13, // Current: 13.81% → Goal: 50%
35+
functions: 11, // Current: 11.86% → Goal: 40%
36+
lines: 16, // Current: 16.14% → Goal: 50%
37+
statements: 16, // Current: 16.08% → Goal: 50%
3838
},
3939
},
4040
}

0 commit comments

Comments
 (0)