Skip to content

test: add Java project test coverage for suggest-optimize hook#33

Open
HeshamHM28 wants to merge 1 commit intomainfrom
add-java-tests
Open

test: add Java project test coverage for suggest-optimize hook#33
HeshamHM28 wants to merge 1 commit intomainfrom
add-java-tests

Conversation

@HeshamHM28
Copy link
Collaborator

Summary

  • Adds 7 bats tests covering all Java paths in the suggest-optimize.sh stop hook
  • Adds test helpers: add_java_commit, create_codeflash_toml, setup_mock_codeflash
  • Confirms Java /optimize flow is working end-to-end (manually verified in Claude Code session)

Tests added

Test What it covers
java: configured + codeflash installed → run codeflash Happy path — runs codeflash --subagent
java: configured + NOT installed → install prompt Prompts pip install codeflash
java: NOT configured + installed → setup prompt Prompts codeflash init --yes
java: NOT configured + NOT installed → install prompt Prompts install first
java: includes auto-allow instructions Appends permissions.allow when missing
java: omits auto-allow when configured Skips when already allowed
java: codeflash.toml takes precedence Precedence over pyproject.toml

Test plan

  • All 39 bats tests pass locally (32 existing + 7 new)
  • Java /optimize manually tested in Claude Code — codeflash found and optimized isPalindrome (39x faster) and bubbleSort (20x faster)

🤖 Generated with Claude Code

Add 7 bats tests covering the Java path in the stop hook:
- configured + installed → run codeflash
- configured + not installed → install prompt
- not configured + installed → setup prompt (codeflash init)
- not configured + not installed → install prompt
- auto-allow instructions when settings.json missing
- omits auto-allow when already configured
- codeflash.toml takes precedence over pyproject.toml

Also adds helpers: add_java_commit, create_codeflash_toml,
setup_mock_codeflash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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