Skip to content

Commit

Permalink
Merge pull request #114 from OneBusAway/fix--enable-test-alerts-displ…
Browse files Browse the repository at this point in the history
…ay-in-test-mode

fix: enable test alerts display in test mode
  • Loading branch information
aaronbrethorst authored Nov 13, 2024
2 parents 6fce316 + 38f6b8e commit 2a8f3a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/routes/api/oba/alerts/+server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export async function GET() {
'alerts.pb',
PRIVATE_OBACO_SHOW_TEST_ALERTS && PRIVATE_OBACO_SHOW_TEST_ALERTS == 'true' ? { test: 1 } : {}
);

const response = await fetch(alertsURL);

const buffer = await response.arrayBuffer();
Expand All @@ -17,6 +18,11 @@ export async function GET() {

let validAlert = null;
for (const entity of feed.entity) {
// If we're in test mode, show the alert to test the UI
if (PRIVATE_OBACO_SHOW_TEST_ALERTS) {
validAlert = entity.alert;
break;
}
if (entity.alert && isValidAlert(entity.alert)) {
validAlert = entity.alert;
break;
Expand Down

0 comments on commit 2a8f3a5

Please sign in to comment.