bash tests/test_profiles.sh (or: make test)
Covers the bug classes that surfaced during recent work, without any
external dependencies or network:
Profile logic (stub `claude` captures exported ANTHROPIC_* env):
- pro profile clears stale ANTHROPIC env and launches claude
- glm/free profiles export BASE_URL/AUTH_TOKEN/MODEL correctly
- error paths: missing OPENROUTER_API_KEY, unknown profile, bad mode
each exit 1
Installer symlink logic (isolated temp HOME, throwaway clone):
- S1 broken/dangling symlink -> repointed via ln -sfn (was fatal before)
- S2 real directory at target -> warning, preserved (was silent)
- S3 free path -> new symlink created
- S4 existing symlink -> repointed
All tests use temp dirs for HOME and a throwaway repo clone, so the real
working tree is never touched.
Co-Authored-By: Claude <noreply@anthropic.com>