Skip to content

Commit

Permalink
Show predicted times in Upcoming Departures
Browse files Browse the repository at this point in the history
Upcoming Departures to this point used scheduled times, when it should
be displaying live predictions (for every mode except CR, which will be
addressed in an upcoming PR). Corrected.
  • Loading branch information
phildarnowsky committed Jan 14, 2020
1 parent af9a5f4 commit ae91bb9
Show file tree
Hide file tree
Showing 5 changed files with 4,632 additions and 4 deletions.
20 changes: 18 additions & 2 deletions apps/site/assets/ts/schedule/__tests__/TripDetailsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { TripDetails, State } from "../components/schedule-finder/TripDetails";
import { TripInfo } from "../components/__trips";
import tripData from "./tripInfo.json";
import crTripData from "./crTripInfo.json";
import tripDataWithPredictions from "./tripInfoWithPredictions.json";

const tripInfo: TripInfo = (tripData as unknown) as TripInfo;
const crTripInfo: TripInfo = (crTripData as unknown) as TripInfo;
const tripInfo: TripInfo = tripData as TripInfo;
const crTripInfo: TripInfo = crTripData as TripInfo;
const tripInfoWithPredictions = tripDataWithPredictions as TripInfo;

const successState = {
data: tripInfo,
Expand All @@ -21,6 +23,12 @@ const crSuccessState = {
error: false
} as State;

const successStateWithPredictions = {
data: tripInfoWithPredictions,
isLoading: false,
error: false
} as State;

const errorState = {
data: null,
isLoading: false,
Expand Down Expand Up @@ -51,4 +59,12 @@ describe("TripDetails", () => {
);
expect(tree).toMatchSnapshot();
});

it("uses a predicted departure time in preference to a scheduled one", () => {
createReactRoot();
const tree = renderer.create(
<TripDetails state={successStateWithPredictions} showFare={false} />
);
expect(tree).toMatchSnapshot();
});
});
Loading

0 comments on commit ae91bb9

Please sign in to comment.