Fix Voxtype invitation action

This commit is contained in:
David Heinemeier Hansson
2026-07-21 11:22:51 -07:00
parent 0526ebefcc
commit 51d6d3c291
2 changed files with 27 additions and 12 deletions
+14 -6
View File
@@ -28,6 +28,17 @@ echo launch >>"$TEST_LOG"
EOF
chmod +x "$test_bin/omarchy-launch-floating-terminal-with-presentation"
cat >"$test_bin/systemd-run" <<'EOF'
#!/bin/bash
echo "systemd-run:$*" >>"$TEST_LOG"
while (($# > 0)); do
[[ $1 == "bash" ]] && exec "$@"
shift
done
exit 1
EOF
chmod +x "$test_bin/systemd-run"
run_invitation_hook() {
cp "$ROOT/install/user/first-run/install-voxtype.hook" "$hook_path"
HOME="$test_home" PATH="$test_bin:$ROOT/bin:$PATH" TEST_LOG="$log_file" bash "$hook_path"
@@ -35,20 +46,17 @@ run_invitation_hook() {
run_invitation_hook
for _ in {1..50}; do
[[ $(wc -l <"$log_file") -eq 2 ]] && break
sleep 0.02
done
[[ -f $test_home/.local/state/omarchy/done/voxtype-install-invitation ]] || fail "Voxtype invitation records completion"
[[ -f $hook_path ]] || fail "Voxtype invitation keeps its hook installed"
[[ $(grep -c '^systemd-run:' "$log_file") -eq 1 ]] || fail "Voxtype invitation uses a durable user service"
grep -q -- '--user --collect --quiet --service-type=exec --unit=omarchy-voxtype-install-invitation' "$log_file" || fail "Voxtype invitation configures its user service"
[[ $(grep -c '^notification$' "$log_file") -eq 1 ]] || fail "Voxtype invitation sends one notification"
[[ $(grep -c '^launch$' "$log_file") -eq 1 ]] || fail "Voxtype invitation handles the notification action"
HOME="$test_home" PATH="$test_bin:$ROOT/bin:$PATH" TEST_LOG="$log_file" bash "$hook_path"
sleep 0.05
[[ -f $hook_path ]] || fail "completed Voxtype invitation keeps its hook installed"
[[ $(grep -c '^systemd-run:' "$log_file") -eq 1 ]] || fail "completed Voxtype invitation does not schedule again"
[[ $(grep -c '^notification$' "$log_file") -eq 1 ]] || fail "completed Voxtype invitation hook does not notify again"
[[ $(grep -c '^launch$' "$log_file") -eq 1 ]] || fail "completed Voxtype invitation hook does not launch again"