diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bad6abd --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: test +test: + @bash tests/test_profiles.sh diff --git a/tests/test_profiles.sh b/tests/test_profiles.sh new file mode 100755 index 0000000..f824f6a --- /dev/null +++ b/tests/test_profiles.sh @@ -0,0 +1,222 @@ +#!/usr/bin/env bash +# +# Tests for claude-launcher-profiles (profile logic + installer). +# +# Design: +# - A stub `claude` captures the ANTHROPIC_* env vars the launcher exports, +# so we can assert on them without a real Claude Code or network. +# - launch_profile calls `exec claude`, so every invocation runs inside a +# subshell — the exec then only ends the subshell, not the test runner. +# - Installer tests run with HOME pointed at a temp dir and a throwaway repo +# clone, so they never touch the real repo working tree. +# +# Run: bash tests/test_profiles.sh +# or: make test + +set -u + +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +TESTS_RUN=0 +TESTS_FAIL=0 +FAILED_CASES=() + +# ---- assert helpers -------------------------------------------------------- + +assert_eq() { + # assert_eq