Skip to content

Comments

Add automated tests for install process#97

Merged
nhorton merged 6 commits intomainfrom
claude/add-install-tests-0QSiv
Jan 21, 2026
Merged

Add automated tests for install process#97
nhorton merged 6 commits intomainfrom
claude/add-install-tests-0QSiv

Conversation

@nhorton
Copy link
Contributor

@nhorton nhorton commented Jan 21, 2026

Add automated tests verifying critical requirements for the install process:

  • REQ-001: Install MUST NOT modify local (user home) Claude settings
  • REQ-002: Install MUST be idempotent for project settings

These are REQUIREMENTS tests that protect user data integrity and ensure installation reliability. They should not be altered - if tests fail, fix the implementation, not the tests.

Test coverage:

  • Local settings protection: verifies ~/.claude/settings.json is untouched
  • Project settings only: verifies only .claude/settings.json in project is modified
  • Idempotency: verifies second install produces identical settings
  • No duplicate hooks: verifies multiple installs don't create duplicates
  • Nth install stability: verifies settings are stable across many installs

claude and others added 6 commits January 21, 2026 15:34
Add automated tests verifying critical requirements for the install process:

- REQ-001: Install MUST NOT modify local (user home) Claude settings
- REQ-002: Install MUST be idempotent for project settings

These are REQUIREMENTS tests that protect user data integrity and ensure
installation reliability. They should not be altered - if tests fail,
fix the implementation, not the tests.

Test coverage:
- Local settings protection: verifies ~/.claude/settings.json is untouched
- Project settings only: verifies only .claude/settings.json in project is modified
- Idempotency: verifies second install produces identical settings
- No duplicate hooks: verifies multiple installs don't create duplicates
- Nth install stability: verifies settings are stable across many installs
Update the idempotency tests to verify that:
- First install MUST actually modify settings (add hooks)
- Only then verify subsequent installs don't change anything

This prevents false positives where a broken install that does nothing
would trivially pass idempotency tests. Also includes lint fixes.
Extract common patterns into reusable helpers:
- run_install(): CLI invocation wrapper
- get_project_settings(): Read and parse settings.json
- assert_install_added_hooks(): Verify first install modified settings

Reduces code by 36 lines while maintaining test clarity.
Extract redundant mock home directory setup into a reusable
context manager that handles directory creation, settings file
writing, and HOME environment patching in one place.
@nhorton nhorton merged commit 98bfe0c into main Jan 21, 2026
4 checks passed
@nhorton nhorton deleted the claude/add-install-tests-0QSiv branch January 21, 2026 17:45
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.

2 participants