diff options
Diffstat (limited to 'scripts/tests/sync-language-bundle.bats')
| -rw-r--r-- | scripts/tests/sync-language-bundle.bats | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/tests/sync-language-bundle.bats b/scripts/tests/sync-language-bundle.bats index 9fd1108..e641646 100644 --- a/scripts/tests/sync-language-bundle.bats +++ b/scripts/tests/sync-language-bundle.bats @@ -44,6 +44,14 @@ matches_canonical() { # project-relative-path canonical-abs-path diff -q "$PROJ/$1" "$2" >/dev/null 2>&1 } +# Mirror install-team.sh: copy only the team overlay's own rule files into a +# synthetic project (no generic rules, hooks, githooks, or settings). +install_team_overlay() { + local team="$1" proj="$2" + mkdir -p "$proj/.claude/rules" + cp "$REAL_REPO/teams/$team/claude/rules/"*.md "$proj/.claude/rules/" +} + # --- Normal: no bundle / clean --- @test "sync: project with no bundle is a quiet no-op (exit 0)" { @@ -151,3 +159,34 @@ matches_canonical() { # project-relative-path canonical-abs-path [ "$status" -eq 1 ] [[ "$output" == *"does not exist"* ]] } + +# --- Team overlays --- + +@test "sync: clean team overlay is a quiet no-op (exit 0)" { + install_team_overlay deepsat "$PROJ" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [ -z "$output" ] +} + +@test "sync: drifted team-overlay rule is auto-fixed and restored" { + install_team_overlay deepsat "$PROJ" + echo "junk drift" >> "$PROJ/.claude/rules/publishing.md" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [[ "$output" == *"team bundle 'deepsat'"* ]] + [[ "$output" == *"publishing.md"* ]] + matches_canonical ".claude/rules/publishing.md" "$REAL_REPO/teams/deepsat/claude/rules/publishing.md" +} + +@test "sync: team overlay does NOT pull in generic claude-rules" { + install_team_overlay deepsat "$PROJ" # only publishing.md present, no commits.md + echo "junk drift" >> "$PROJ/.claude/rules/publishing.md" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + # A team overlay owns only its own rule; the sync must not copy generic + # rules (commits.md, testing.md, ...) into the project the way a language + # bundle does. + [ ! -f "$PROJ/.claude/rules/commits.md" ] + [ ! -f "$PROJ/.claude/rules/testing.md" ] +} |
