Community 93 Premium feature complete

This commit is contained in:
Eric Gullickson
2025-12-21 11:31:10 -06:00
parent 1bde31247f
commit 95f5e89e48
60 changed files with 8061 additions and 350 deletions

View File

@@ -33,14 +33,14 @@ make shell-backend
npm test
# Test single feature (complete isolation)
npm test -- features/vehicles
npm test -- --testPathPattern=src/features/vehicles
# Test specific test type
npm test -- features/vehicles/tests/unit
npm test -- features/vehicles/tests/integration
npm test -- --testPathPattern=src/features/vehicles/tests/unit
npm test -- --testPathPattern=src/features/vehicles/tests/integration
# Test with coverage
npm test -- features/vehicles --coverage
npm test -- --testPathPattern=src/features/vehicles --coverage
# Watch mode
npm run test:watch
@@ -89,25 +89,24 @@ Example: `vehicles.integration.test.ts`
- Tests database persistence
- Tests error responses
### Test Fixtures
**Location**: `features/[name]/tests/fixtures/`
**Purpose**: Reusable test data
**Format**: JSON files with valid test objects
### Test Data
**Location**: Inline within test files
**Purpose**: Test-specific mock data
**Format**: TypeScript objects defined in test files
Example: `vehicles.fixtures.json`
```json
{
"validVehicle": {
"vin": "1HGBH41JXMN109186",
"nickname": "Test Honda",
"color": "Blue"
},
"vpicResponse": {
"Make": "Honda",
"Model": "Civic",
"ModelYear": "2021"
}
}
Tests use inline mock data rather than external fixture files. Example pattern:
```typescript
const mockVehicle = {
vin: "1HGBH41JXMN109186",
nickname: "Test Honda",
color: "Blue"
};
const mockPlatformResponse = {
make: "Honda",
model: "Civic",
year: 2021
};
```
## Testing Commands Reference
@@ -121,10 +120,10 @@ make shell-backend
npm test
# Run specific feature
npm test -- features/vehicles
npm test -- features/fuel-logs
npm test -- features/maintenance
npm test -- features/stations
npm test -- --testPathPattern=src/features/vehicles
npm test -- --testPathPattern=src/features/fuel-logs
npm test -- --testPathPattern=src/features/maintenance
npm test -- --testPathPattern=src/features/stations
# Run with file watching
npm run test:watch
@@ -142,7 +141,7 @@ docker compose exec mvp-frontend npm test
### Coverage Reports
```bash
# Generate coverage for specific feature
npm test -- features/vehicles --coverage
npm test -- --testPathPattern=src/features/vehicles --coverage
# View coverage report
# Inside the container, open using your OS tooling,
@@ -177,8 +176,14 @@ make clean && make start
- **Seeding**: Use feature-level fixtures when needed
### Coverage and Availability
- Full test suite exists for `vehicles`.
- Other features (e.g., `fuel-logs`, `stations`, `maintenance`) have placeholders and are being built out.
All features have comprehensive test suites with unit and integration tests:
- `admin` - Unit + integration tests
- `documents` - Unit + integration tests
- `fuel-logs` - Unit + integration tests
- `maintenance` - Unit + integration tests
- `platform` - Unit + integration tests
- `stations` - Unit + integration tests (including community stations)
- `vehicles` - Unit + integration tests
### Mock Strategy
- **External APIs**: Completely mocked (vPIC, Google Maps)
@@ -188,17 +193,20 @@ make clean && make start
## Test Data Management
### Fixtures Strategy
```javascript
// In test files
import fixtures from '../fixtures/vehicles.fixtures.json';
### Inline Mock Data Strategy
```typescript
// In test files - define mock data inline
const mockVehicle = {
vin: '1HGBH41JXMN109186',
nickname: 'Test Honda',
year: 2021,
make: 'Honda',
model: 'Civic'
};
describe('Vehicle Service', () => {
it('should create vehicle', async () => {
const result = await vehicleService.create(
fixtures.validVehicle,
'user123'
);
const result = await vehicleService.create(mockVehicle, 'user123');
expect(result.make).toBe('Honda');
});
});