Fix pending migration notifications

This commit is contained in:
David Heinemeier Hansson
2026-07-20 11:07:44 -07:00
parent 5232505c12
commit 8719b0d031
4 changed files with 41 additions and 6 deletions
+13 -1
View File
@@ -9,7 +9,14 @@ trap 'rm -rf "$test_tmp"' EXIT
test_root="$test_tmp/omarchy"
test_home="$test_tmp/home"
mkdir -p "$test_root/migrations" "$test_home"
stub_bin="$test_tmp/bin"
mkdir -p "$test_root/migrations" "$test_home" "$stub_bin"
cat >"$stub_bin/omarchy-notification-dismiss" <<'SH'
#!/bin/bash
printf '%s\n' "$1" >>"$TEST_DISMISSALS"
SH
chmod +x "$stub_bin/omarchy-notification-dismiss"
cat >"$test_root/migrations/100-migration.sh" <<'SH'
echo migration >>"$TEST_CALLS"
@@ -18,7 +25,9 @@ SH
run_migrate() {
HOME="$test_home" \
OMARCHY_PATH="$test_root" \
PATH="$stub_bin:$ROOT/bin:$PATH" \
TEST_CALLS="$test_tmp/calls" \
TEST_DISMISSALS="$test_tmp/dismissals" \
"$ROOT/bin/omarchy-migrate" "$@"
}
@@ -27,6 +36,9 @@ run_migrate >"$test_tmp/migrate.out"
[[ $(sed -n '1p' "$test_tmp/calls") == "migration" ]] || fail "omarchy-migrate runs pending migrations"
pass "omarchy-migrate runs migrations without force"
grep -Fx 'Omarchy Migrations' "$test_tmp/dismissals" >/dev/null || fail "omarchy-migrate dismisses migration notifications"
pass "omarchy-migrate clears completed migration notifications"
rm -rf "$test_home/.local/state/omarchy/migrations"
run_migrate --pending >"$test_tmp/pending.out"
grep -q '^100-migration\.sh$' "$test_tmp/pending.out" || fail "omarchy-migrate --pending lists pending migrations"