Skip to content

Commit 2a8f3a5

Browse files
Merge pull request #114 from OneBusAway/fix--enable-test-alerts-display-in-test-mode
fix: enable test alerts display in test mode
2 parents 6fce316 + 38f6b8e commit 2a8f3a5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/routes/api/oba/alerts/+server.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export async function GET() {
99
'alerts.pb',
1010
PRIVATE_OBACO_SHOW_TEST_ALERTS && PRIVATE_OBACO_SHOW_TEST_ALERTS == 'true' ? { test: 1 } : {}
1111
);
12+
1213
const response = await fetch(alertsURL);
1314

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

1819
let validAlert = null;
1920
for (const entity of feed.entity) {
21+
// If we're in test mode, show the alert to test the UI
22+
if (PRIVATE_OBACO_SHOW_TEST_ALERTS) {
23+
validAlert = entity.alert;
24+
break;
25+
}
2026
if (entity.alert && isValidAlert(entity.alert)) {
2127
validAlert = entity.alert;
2228
break;

0 commit comments

Comments
 (0)