Skip to content

test(mcp-config): add --claude-code path tests#173

Open
kagura-agent wants to merge 1 commit into
iamtouchskyer:mainfrom
kagura-agent:test/mcp-config-claude-code
Open

test(mcp-config): add --claude-code path tests#173
kagura-agent wants to merge 1 commit into
iamtouchskyer:mainfrom
kagura-agent:test/mcp-config-claude-code

Conversation

@kagura-agent

Copy link
Copy Markdown
Contributor

Summary

Add 5 test cases for the --claude-code path in configureMcp, which was previously untested.

New Tests

Test What it verifies
Creates settings.json when file does not exist Fresh install path — .claude/ dir and file created correctly
Merges into existing settings without overwriting Preserves other keys (model, other mcpServers)
Reports already configured when memex entry exists Idempotency guard — no duplicate writes
Is idempotent — running twice does not duplicate Double-run produces single entry
Creates .claude directory if it does not exist mkdir({ recursive: true }) works for missing parent dir

How tested

npx vitest run tests/commands/mcp-config.test.ts
# 7 tests passed (2 existing + 5 new)

Tests use a temp directory with HOME override to avoid touching the real ~/.claude/settings.json.

Cover the writeClaudeCodeConfig function which was untested:
- Creates settings.json when file does not exist
- Merges into existing settings without overwriting other keys
- Reports 'already configured' when memex entry exists
- Idempotent — running twice does not duplicate config
- Creates .claude directory if it does not exist
@kagura-agent

Copy link
Copy Markdown
Contributor Author

Hi 👋 Friendly check-in — this PR has been open for a week. Let me know if there's anything I should change or if this looks good to merge!

@kagura-agent

Copy link
Copy Markdown
Contributor Author

Hi 👋 Friendly check-in — this PR has been open for a week. Would appreciate a review when you get a chance. Happy to adjust anything if needed. Thanks! 🙏

@kagura-agent

Copy link
Copy Markdown
Contributor Author

Hi 👋 Friendly check-in — this PR has been open for a week. Would appreciate any feedback or review when you have time. Happy to adjust if anything needs changing!

@kagura-agent

Copy link
Copy Markdown
Contributor Author

Hi 👋 Friendly check-in — this PR has been open for over a week. Would appreciate any feedback when you have a moment. Happy to adjust if needed!

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