Skip to content

Commit 14e9aae

Browse files
authored
Merge pull request #2 from frckbrice/fix/code-quality
Fix/code quality
2 parents f5e1d36 + 49ae70d commit 14e9aae

123 files changed

Lines changed: 53948 additions & 133 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@
1010
],
1111
"rules": {
1212
"@typescript-eslint/no-unused-vars": [
13-
"warn"
13+
"error",
14+
{
15+
"argsIgnorePattern": "^_"
16+
}
1417
],
1518
"no-unused-vars": [
16-
"warn"
19+
"error",
20+
{
21+
"argsIgnorePattern": "^_"
22+
}
1723
],
1824
"@typescript-eslint/no-explicit-any": "warn",
1925
"prettier/prettier": "error",

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.env
33
.env.local
44
env.local
5-
docker-compose.yml
65

76
# Dependencies
87
node_modules/

TEST_PLAN.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Test Coverage Improvement Plan
2+
3+
## Current Coverage Status
4+
- Overall: 27.05%
5+
- Branches: 53.65%
6+
- Functions: 11.47%
7+
- Lines: 27.05%
8+
9+
## Priority Areas
10+
11+
### 1. Controllers (7.8%)
12+
13+
#### High Priority
14+
- `auth.controller.ts` (18.21%)
15+
- [ ] Test successful user registration
16+
- [ ] Test password validation
17+
- [ ] Test email validation
18+
- [ ] Test OTP verification
19+
- [ ] Test OAuth flows (Google/Facebook)
20+
- [ ] Test refresh token functionality
21+
22+
#### Medium Priority
23+
- `product.controller.ts` (7.89%)
24+
- [ ] Test product creation
25+
- [ ] Test product updates
26+
- [ ] Test product deletion
27+
- [ ] Test product listing
28+
- [ ] Test product search
29+
30+
- `order.controller.ts` (5.58%)
31+
- [ ] Test order creation
32+
- [ ] Test order status updates
33+
- [ ] Test order listing
34+
- [ ] Test order cancellation
35+
36+
#### Lower Priority
37+
- `notification.controller.ts` (5.18%)
38+
- `product.search.controller.ts` (4.95%)
39+
- `review.controller.ts` (4.77%)
40+
- `user.controller.ts` (7.1%)
41+
42+
### 2. Middleware (26.07%)
43+
44+
#### High Priority
45+
- `auth-check.ts` (6.77%)
46+
- [ ] Test token validation
47+
- [ ] Test role-based access
48+
- [ ] Test expired tokens
49+
- [ ] Test malformed tokens
50+
51+
#### Medium Priority
52+
- `multerStorage.ts` (33.92%)
53+
- [ ] Test file upload success
54+
- [ ] Test file size limits
55+
- [ ] Test file type validation
56+
- [ ] Test storage configuration
57+
58+
- `handleExpoResponse.ts` (10.86%)
59+
- [ ] Test notification sending
60+
- [ ] Test error handling
61+
- [ ] Test device token validation
62+
63+
#### Lower Priority
64+
- `send-notification.ts` (7.4%)
65+
- `rateLimiter.ts` (76.19% - already decent)
66+
67+
### 3. Models (73.21%)
68+
69+
#### High Priority
70+
- `index.ts` (0%)
71+
- [ ] Test model associations
72+
- [ ] Test database connection
73+
- [ ] Test model synchronization
74+
75+
### 4. Routes (72.39%)
76+
77+
#### High Priority
78+
- `payment.collection.routes.ts` (64.51%)
79+
- [ ] Test payment initiation
80+
- [ ] Test payment callbacks
81+
- [ ] Test payment status updates
82+
83+
#### Medium Priority
84+
- `review.routes.ts` (60%)
85+
- [ ] Test review creation
86+
- [ ] Test review updates
87+
- [ ] Test review deletion
88+
89+
- `user.routes.ts` (63.33%)
90+
- [ ] Test profile updates
91+
- [ ] Test address management
92+
- [ ] Test settings updates
93+
94+
## Implementation Strategy
95+
96+
1. **Setup Improvements**
97+
- [ ] Create test utilities for common operations
98+
- [ ] Set up test database configuration
99+
- [ ] Create mock factories for test data
100+
- [ ] Improve test isolation
101+
102+
2. **Testing Approach**
103+
- Use integration tests for routes
104+
- Use unit tests for utilities and helpers
105+
- Use mock data for external services
106+
- Focus on error cases and edge conditions
107+
108+
3. **Mocking Strategy**
109+
- [ ] Create mock implementations for:
110+
- Database operations
111+
- External APIs (Cloudinary, OAuth providers)
112+
- Email/SMS services
113+
- Payment gateways
114+
115+
4. **CI/CD Integration**
116+
- [ ] Add coverage reporting to CI pipeline
117+
- [ ] Set up coverage thresholds
118+
- [ ] Add test status badges to README
119+
120+
## Long-term Goals
121+
122+
1. Achieve and maintain:
123+
- 80% overall coverage
124+
- 80% branch coverage
125+
- 80% function coverage
126+
- 80% line coverage
127+
128+
2. Implement:
129+
- End-to-end tests for critical flows
130+
- Performance tests for key endpoints
131+
- Security tests for authentication/authorization
132+
- Load tests for high-traffic endpoints
133+
134+
## Notes
135+
136+
- Focus on business-critical paths first
137+
- Prioritize security-related functionality
138+
- Document test patterns and best practices
139+
- Regular review and updates of test coverage
140+
- Consider adding property-based testing for complex logic

0 commit comments

Comments
 (0)