Files
Panama/tests/quickshell/calendar-agenda-contract.sh
T

69 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
fail() {
printf 'calendar agenda contract: %s\n' "$1" >&2
exit 1
}
cleanup() {
qs ipc call calendar-agenda reset >/dev/null 2>&1 || true
qs ipc call calendar-agenda close >/dev/null 2>&1 || true
}
trap cleanup EXIT
qs ipc show | rg -q '^target calendar-agenda$' \
|| fail 'calendar IPC target is missing'
qs ipc call calendar-agenda fixture daybook >/dev/null
status="$(qs ipc call calendar-agenda status)"
jq -e '
.fixture == true and
.sourceCount == 3 and
.eventCount == 5 and
.selectedDate == "2026-08-17"
' <<<"$status" >/dev/null || fail 'daybook fixture state is malformed'
qs ipc call calendar-agenda select 2026-08-18 >/dev/null
jq -e '.selectedDate == "2026-08-18" and .selectedEventCount == 1' \
<<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|| fail 'date selection did not update events'
qs ipc call calendar-agenda open >/dev/null
jq -e '.open == true and .page == "agenda"' \
<<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|| fail 'calendar open did not route to Agenda'
qs ipc call notifications open >/dev/null
jq -e '.open == true and .page == "notifications"' \
<<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|| fail 'notification open did not route to Notifications'
hyprctl layers | rg -q 'namespace: qs-popover-datemenu' \
|| fail 'Daybook layer did not map'
rg -q 'implicitWidth: 760' config/dot/quickshell/modules/datemenu/DateMenu.qml \
|| fail 'Daybook is not the approved width'
for component in AgendaPane AgendaEvent NotificationSummary; do
rg -q "${component} 1.0 ${component}.qml" config/dot/quickshell/modules/datemenu/qmldir \
|| fail "$component is not registered"
done
qs ipc call calendar-agenda fixture upcoming >/dev/null
jq -e '.capsuleVisible == true and .capsuleText == "12m"' \
<<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|| fail 'upcoming capsule window is wrong'
qs ipc call calendar-agenda fixture outside-window >/dev/null
jq -e '.capsuleVisible == false' \
<<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|| fail 'capsule appears outside the quiet window'
qs ipc call calendar-agenda reset >/dev/null
jq -e '.fixture == false' <<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|| fail 'fixture reset did not restore live mode'
trap - EXIT
cleanup
printf 'calendar agenda contract: PASS\n'