fix(cli): filter outage schedule by selected bill
This commit is contained in:
@@ -143,8 +143,8 @@ assert_contains "${SCHEDULE[2]}" '"outage_number":"5"' \
|
||||
"later events should remain in the schedule"
|
||||
|
||||
build_schedule "$FIXTURE" "$NOW_EPOCH" "222"
|
||||
assert_equal "3" "${#SCHEDULE[@]}" \
|
||||
"selecting a countdown bill should not filter the schedule"
|
||||
assert_equal "1" "${#SCHEDULE[@]}" \
|
||||
"selecting a bill should filter the schedule"
|
||||
assert_equal "UPCOMING" "${HERO%%$'\t'*}" \
|
||||
"the countdown should ignore another bill's ongoing outage"
|
||||
assert_contains "$HERO" '"bill_id":"222"' \
|
||||
@@ -152,17 +152,21 @@ assert_contains "$HERO" '"bill_id":"222"' \
|
||||
SELECTED_OUTPUT="$(NO_COLOR=1 COLUMNS=80 render_dashboard "$NOW_EPOCH" 80 "222")"
|
||||
assert_contains "$SELECTED_OUTPUT" "COUNTDOWN FOR BILL 222" \
|
||||
"the selected countdown bill should be labeled"
|
||||
assert_contains "$SELECTED_OUTPUT" "OUTAGE SCHEDULE (3)" \
|
||||
"the selected countdown bill should not hide other bills from the list"
|
||||
assert_contains "$SELECTED_OUTPUT" "OUTAGE SCHEDULE (1)" \
|
||||
"the schedule should contain only the selected bill"
|
||||
if [[ "$SELECTED_OUTPUT" == *"Bill 111"* ]]; then
|
||||
printf 'FAIL: selected bill output contains another bill\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_schedule "$FIXTURE" "$NOW_EPOCH" "333"
|
||||
assert_equal "" "$HERO" \
|
||||
"a bill without upcoming outages should not borrow another bill's countdown"
|
||||
assert_equal "0" "${#SCHEDULE[@]}" \
|
||||
"a bill without upcoming outages should have an empty schedule"
|
||||
NO_HERO_OUTPUT="$(NO_COLOR=1 COLUMNS=80 render_dashboard "$NOW_EPOCH" 80 "333")"
|
||||
assert_contains "$NO_HERO_OUTPUT" "NO CURRENT OR UPCOMING OUTAGE" \
|
||||
"a selected bill without outages should have a clear countdown status"
|
||||
assert_contains "$NO_HERO_OUTPUT" "OUTAGE SCHEDULE (3)" \
|
||||
"all bills should remain listed when the selected bill has no outage"
|
||||
assert_contains "$NO_HERO_OUTPUT" "ALL CLEAR" \
|
||||
"a selected bill without outages should render the all-clear screen"
|
||||
|
||||
build_schedule "$FIXTURE" "$NOW_EPOCH"
|
||||
OUTPUT="$(NO_COLOR=1 COLUMNS=80 render_dashboard "$NOW_EPOCH")"
|
||||
|
||||
Reference in New Issue
Block a user