Skip to content

Commit 71d619b

Browse files
garyshengclaude
andcommitted
Add GitHub Actions CI and fix tests for behavior changes
- Add test.yml workflow: runs bats on macOS for PRs and pushes to main - Fix tests for new behavior: Stop plays complete sound, idle_prompt is silent, acceptEdits is interactive (not agent), only delegate is suppressed - 31 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d1f544b commit 71d619b

2 files changed

Lines changed: 33 additions & 8 deletions

File tree

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: macos-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install bats-core
16+
run: brew install bats-core
17+
18+
- name: Run tests
19+
run: bats tests/

tests/peon.bats

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ teardown() {
3030
[[ "$sound" == *"/packs/peon/sounds/Perm"* ]]
3131
}
3232

33-
@test "Notification idle_prompt plays a complete sound" {
33+
@test "Notification idle_prompt does NOT play sound (Stop handles it)" {
3434
run_peon '{"hook_event_name":"Notification","notification_type":"idle_prompt","cwd":"/tmp/myproject","session_id":"s1","permission_mode":"default"}'
3535
[ "$PEON_EXIT" -eq 0 ]
36-
afplay_was_called
37-
sound=$(afplay_sound)
38-
[[ "$sound" == *"/packs/peon/sounds/Done"* ]]
36+
! afplay_was_called
3937
}
4038

41-
@test "Stop does NOT play any sound" {
39+
@test "Stop plays a complete sound" {
4240
run_peon '{"hook_event_name":"Stop","cwd":"/tmp/myproject","session_id":"s1","permission_mode":"default"}'
4341
[ "$PEON_EXIT" -eq 0 ]
44-
! afplay_was_called
42+
afplay_was_called
43+
sound=$(afplay_sound)
44+
[[ "$sound" == *"/packs/peon/sounds/Done"* ]]
4545
}
4646

4747
@test "UserPromptSubmit does NOT play sound normally" {
@@ -102,8 +102,14 @@ JSON
102102
# Agent/teammate detection
103103
# ============================================================
104104

105-
@test "agent session (permission_mode=acceptEdits) suppresses sound" {
106-
run_peon '{"hook_event_name":"SessionStart","cwd":"/tmp/myproject","session_id":"agent1","permission_mode":"acceptEdits"}'
105+
@test "acceptEdits is interactive, NOT suppressed" {
106+
run_peon '{"hook_event_name":"SessionStart","cwd":"/tmp/myproject","session_id":"s1","permission_mode":"acceptEdits"}'
107+
[ "$PEON_EXIT" -eq 0 ]
108+
afplay_was_called
109+
}
110+
111+
@test "delegate mode suppresses sound (agent session)" {
112+
run_peon '{"hook_event_name":"SessionStart","cwd":"/tmp/myproject","session_id":"agent1","permission_mode":"delegate"}'
107113
[ "$PEON_EXIT" -eq 0 ]
108114
! afplay_was_called
109115
}

0 commit comments

Comments
 (0)