feat(cli): add height-aware compact outage schedule
All checks were successful
Test blackout notifier / test (push) Successful in 5s
Hourly blackout check / check (push) Successful in 5s

This commit is contained in:
2026-07-27 18:03:18 +03:30
parent 0b24d544d3
commit bf09d4d99c
3 changed files with 153 additions and 26 deletions

View File

@@ -120,6 +120,8 @@ assert_equal "01 : 01 : 01" "$(banner_duration 3661)" \
"countdowns should include hours, minutes, and seconds"
assert_equal "49 : 30 : 00" "$(banner_duration 178200)" \
"countdowns should use total hours beyond one day"
assert_equal "17" "$(LINES=17 terminal_lines)" \
"the terminal height override should be respected"
FONT_OUTPUT="$(print_large_countdown "00 : 00 : 00" 150)"
assert_contains "$FONT_OUTPUT" ',a8888a,' \
"the countdown should consistently use the univers-style font"
@@ -189,6 +191,17 @@ if [[ "$OUTPUT" == *$'\033['* ]]; then
printf 'FAIL: NO_COLOR output contains ANSI escapes\n' >&2
exit 1
fi
SHORT_OUTPUT="$(NO_COLOR=1 COLUMNS=80 LINES=12 render_dashboard "$NOW_EPOCH" 80 "" 12)"
SHORT_LINE_COUNT="$(awk 'END { print NR }' <<<"$SHORT_OUTPUT")"
assert_equal "12" "$SHORT_LINE_COUNT" \
"a dashboard with extra outages should fit the terminal height"
assert_contains "$SHORT_OUTPUT" '01 : 00 : 00' \
"the countdown should remain visible when schedule rows are limited"
assert_contains "$SHORT_OUTPUT" "... 2 more outages" \
"the dashboard should report schedule rows that do not fit"
SHORT_BOTTOM_LINE="${SHORT_OUTPUT##*$'\n'}"
assert_equal "$(repeat_character '=' 80)" "$SHORT_BOTTOM_LINE" \
"the compact schedule should end with a full-width rule"
WIDE_OUTPUT="$(NO_COLOR=1 COLUMNS=180 render_dashboard "$NOW_EPOCH")"
WIDE_TOP_LINE="${WIDE_OUTPUT%%$'\n'*}"
assert_equal "180" "${#WIDE_TOP_LINE}" \
@@ -196,6 +209,8 @@ assert_equal "180" "${#WIDE_TOP_LINE}" \
WIDE_BOTTOM_LINE="${WIDE_OUTPUT##*$'\n'}"
assert_equal "180" "${#WIDE_BOTTOM_LINE}" \
"the dashboard bottom divider should span the full terminal width"
assert_equal "$(repeat_character '=' 180)" "$WIDE_BOTTOM_LINE" \
"the dashboard should end with the same rule as the countdown section"
FUTURE_NOW="$(TZ=Asia/Tehran date -d '2026-07-18 15:00:00' +%s)"
build_schedule "$FIXTURE" "$FUTURE_NOW"