Skip to content

test(commit-ai): add comprehensive pytest test suite#41

Open
Agolid wants to merge 1 commit into
josharsh:mainfrom
Agolid:main
Open

test(commit-ai): add comprehensive pytest test suite#41
Agolid wants to merge 1 commit into
josharsh:mainfrom
Agolid:main

Conversation

@Agolid

@Agolid Agolid commented Mar 27, 2026

Copy link
Copy Markdown

🎯 Goal

Add unit tests for the commit message generator to ensure quality.

📋 What Was Done

  • ✅ Added 15+ test cases covering core functionality
  • ✅ Tests for git diff parsing (staged/unstaged, empty diffs)
  • ✅ Branch detection and recent commit history retrieval
  • ✅ Mocked Anthropic API for isolated testing
  • ✅ Edge case coverage: unicode, special chars, large diffs
  • ✅ Conventional commit format validation tests
  • ✅ Updated README with testing documentation

✅ Acceptance Criteria Met

  • 5+ test cases covering core functionality (15+ added)
  • Tests pass with pytest
  • Mock Anthropic API calls
  • Document how to run tests in README

🎓 Learning Outcomes

  • pytest framework
  • Mocking external APIs with unittest.mock
  • Test-driven development practices
  • CI/CD preparation ready

Resolves #20

- Add 15+ test cases covering core functionality
- Test git diff parsing, branch detection, commit history
- Mock Anthropic API for isolated testing
- Test edge cases: empty diffs, unicode, special chars
- Add conventional commit validation tests
- Document testing workflow in README

Resolves issue josharsh#20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🧪 Add pytest test suite for commit-ai

1 participant