-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Description
Currently, RepoReady has zero test files despite having Jest configured in package.json and @types/jest installed. This is a critical gap that needs to be addressed to ensure code reliability and make the project more contributor-friendly.
Current State
- ✅ Jest is configured in
package.jsonwith script"test": "jest" - ✅ Jest dependencies are installed (
jest,@types/jest) - ❌ No test files exist in the project
- ❌ No test directory structure
Acceptance Criteria
Test Structure
- Create
src/__tests__/ortests/directory - Add Jest configuration file (
jest.config.js) - Create test files for all major components:
-
src/evaluator/index.test.ts -
src/evaluator/criteria.test.ts -
src/utils/github.test.ts -
src/utils/display.test.ts -
src/commands/evaluate.test.ts -
src/commands/create.test.ts
-
Test Coverage
- Achieve minimum 80% code coverage
- Test all evaluation criteria functions
- Test score calculation logic
- Test rating determination
- Mock GitHub API calls for consistent testing
CI Integration
- Update
npm testto work properly - Add coverage reporting
- Include test results in future CI pipeline
Implementation Suggestions
Sample Test Structure
// src/__tests__/evaluator/criteria.test.ts
import { evaluationCriteria, calculateRating } from '../evaluator/criteria';
import { RepositoryInfo } from '../types';
describe('Evaluation Criteria', () => {
describe('calculateRating', () => {
it('should return "Excellent" for 90-100%', () => {
expect(calculateRating(95)).toBe('Excellent');
});
it('should return "Good" for 75-89%', () => {
expect(calculateRating(80)).toBe('Good');
});
// ... more tests
});
});Mock Repository Data
const mockRepo: RepositoryInfo = {
owner: 'test-owner',
repo: 'test-repo',
name: 'test-repo',
description: 'A test repository for unit testing',
topics: ['test', 'typescript'],
hasReadme: true,
hasContributing: false,
// ... other properties
};Files to Focus On
src/evaluator/criteria.ts(158 lines - core scoring logic)src/utils/github.ts(317 lines - API interactions)src/evaluator/index.ts(33 lines - main evaluator)
Benefits
- 🛡️ Prevents regressions when adding new features
- 🚀 Makes it safer for new contributors to make changes
- 📊 Provides confidence in the scoring algorithm
- 🔍 Helps identify edge cases and bugs
Resources
Estimated Effort
Medium - Requires understanding of the codebase and testing patterns, but well-defined scope.
This issue is perfect for contributors who want to learn about testing patterns and ensure code quality! 🧪
Metadata
Metadata
Assignees
Labels
No labels