All files / api/trimet-client/src alertScopes.ts

100% Statements 6/6
100% Branches 6/6
100% Functions 6/6
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18      5x 5x   4x         2x 5x   4x      
import type { Alert } from "./interfaces/alertsData";
 
export function getAlertsForRoute(alerts: Alert[], routeId: number): Alert[] {
  return alerts.filter(alert =>
    alert.system_wide_flag ||
    !alert.route?.length ||
    alert.route.some(route => route.route === routeId)
  );
}
 
export function getAlertsForStop(alerts: Alert[], stopId: number): Alert[] {
  return alerts.filter(alert =>
    alert.system_wide_flag ||
    !alert.location?.length ||
    alert.location.some(location => location.id === stopId)
  );
}