Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Dec 18, 2024
1 parent e293a16 commit bf902d8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/dotcom_web/live/trip_planner_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ defmodule DotcomWeb.Live.TripPlannerTest do
expect(OpenTripPlannerClient.Mock, :plan, fn _ ->
{:ok, %OpenTripPlannerClient.Plan{itineraries: itineraries}}
end)

# For certain routes, Dotcom.TripPlan.Alerts.mode_entities/1 is called to help fetch the associated alerts
stub(MBTA.Api.Mock, :get_json, fn "/trips/" <> id, [] ->
%JsonApi{
data: [
Test.Support.Factories.MBTA.Api.build(:trip_item, %{id: id})
]
}
end)
end

defp stub_populated_otp_results do
Expand Down Expand Up @@ -227,6 +236,14 @@ defmodule DotcomWeb.Live.TripPlannerTest do
}}
end)

stub(MBTA.Api.Mock, :get_json, fn "/trips/" <> id, [] ->
%JsonApi{
data: [
Test.Support.Factories.MBTA.Api.build(:trip_item, %{id: id})
]
}
end)

{:ok, view, _html} = live(conn, ~p"/preview/trip-planner?#{params}")

render_async(view)
Expand All @@ -253,6 +270,14 @@ defmodule DotcomWeb.Live.TripPlannerTest do
}}
end)

stub(MBTA.Api.Mock, :get_json, fn "/trips/" <> id, [] ->
%JsonApi{
data: [
Test.Support.Factories.MBTA.Api.build(:trip_item, %{id: id})
]
}
end)

{:ok, view, _html} = live(conn, ~p"/preview/trip-planner?#{params}")

render_async(view)
Expand All @@ -276,6 +301,14 @@ defmodule DotcomWeb.Live.TripPlannerTest do
}}
end)

stub(MBTA.Api.Mock, :get_json, fn "/trips/" <> id, [] ->
%JsonApi{
data: [
Test.Support.Factories.MBTA.Api.build(:trip_item, %{id: id})
]
}
end)

{:ok, view, _html} = live(conn, ~p"/preview/trip-planner?#{params}")

render_async(view)
Expand Down

0 comments on commit bf902d8

Please sign in to comment.