Skip to content

Add comprehensive test suite (71 tests)#61

Open
dines-rl wants to merge 1 commit intomainfrom
agent/add-comprehensive-test-suite
Open

Add comprehensive test suite (71 tests)#61
dines-rl wants to merge 1 commit intomainfrom
agent/add-comprehensive-test-suite

Conversation

@dines-rl
Copy link
Owner

@dines-rl dines-rl commented Mar 2, 2026

Summary

  • Farm.test.ts: Expanded with edge cases — empty arrays, multiple same-animal inputs, unrecognized animal types
  • AstforFile.test.ts (new): 10 tests for `ASTForFile` and `ASTForFileToFile`, using mocked `tree-sitter` and `fs` modules to avoid native binary dependency
  • GetDiffForFile.test.ts (new): 13 tests for `getSuggestionsFromGPT` with mocked OpenAI — covers successful suggestions, line number resolution (`determineLineStart`), null/error responses, and default parameter values
  • IssuesTester.test.ts (new): 15 tests for the Probot `issues.opened` and `issues.closed` handlers, using a mock Probot app + mocked Runloop client
  • index.test.ts (new): 16 tests for the `pull_request.opened/closed/reopened` handlers, covering devbox lifecycle, GPT integration, review comments, build failures, and error paths

Total: 71 tests across 5 test files — all passing.

Test plan

  • `npm test` (vitest run) passes all 71 tests locally
  • No real API calls made — OpenAI, Runloop, and tree-sitter are all mocked
  • Edge cases covered: API failures, devbox not reaching running state, GPT returning no changes, build failures after applying changes

🤖 Generated with Claude Code

- Expand Farm.test.ts with edge cases (empty arrays, multiple animals, unrecognized types)
- Add AstforFile.test.ts: unit tests for ASTForFile and ASTForFileToFile with mocked tree-sitter and fs
- Add GetDiffForFile.test.ts: unit tests for getSuggestionsFromGPT with mocked OpenAI, covering line number resolution, error handling, and parameter defaults
- Add IssuesTester.test.ts: Probot handler tests for issues.opened and issues.closed with mocked Runloop client
- Add index.test.ts: Probot handler tests for pull_request.opened/closed/reopened with mocked Runloop and GPT

Total: 71 tests across 5 test files, all passing.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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.

1 participant