Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaddox5 committed Dec 9, 2024
1 parent a548e78 commit 131c756
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
75 changes: 43 additions & 32 deletions test/screens/v2/candidate_generator/elevator/closures_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,21 @@ defmodule Screens.V2.CandidateGenerator.Elevator.ClosuresTest do
^header_instance,
%ElevatorClosuresList{
app_params: ^config,
in_station_closures: [
%{
id: "1",
description: nil,
elevator_name: "Test",
elevator_id: "facility-test",
header_text: nil
stations_with_closures: [
%ElevatorClosuresList.Station{
id: "place-test",
name: "Place Test",
route_icons: [%{type: :text, text: "RL", color: :red}],
closures: [
%Closure{
id: "1",
elevator_name: "Test",
elevator_id: "facility-test"
}
]
}
],
other_stations_with_closures: []
station_id: "place-test"
},
^footer_instance
] =
Expand Down Expand Up @@ -149,8 +154,7 @@ defmodule Screens.V2.CandidateGenerator.Elevator.ClosuresTest do
^header_instance,
%ElevatorClosuresList{
app_params: ^config,
in_station_closures: [],
other_stations_with_closures: [
stations_with_closures: [
%{
id: "place-haecl",
name: "Haymarket",
Expand Down Expand Up @@ -222,8 +226,7 @@ defmodule Screens.V2.CandidateGenerator.Elevator.ClosuresTest do
^header_instance,
%ElevatorClosuresList{
app_params: ^config,
in_station_closures: [],
other_stations_with_closures: []
stations_with_closures: []
},
^footer_instance
] =
Expand Down Expand Up @@ -297,22 +300,25 @@ defmodule Screens.V2.CandidateGenerator.Elevator.ClosuresTest do
accessible_path_image_url: nil,
accessible_path_image_here_coordinates: %{y: 0, x: 0}
},
in_station_closures: [
%Screens.V2.WidgetInstance.Elevator.Closure{
id: "1",
elevator_name: "In Station Elevator",
elevator_id: "112",
description: nil,
header_text: nil
}
],
other_stations_with_closures: [
stations_with_closures: [
%ElevatorClosuresList.Station{
id: "place-test",
name: "This Station",
route_icons: [%{type: :text, text: "RL", color: :red}],
closures: [
%Closure{
id: "1",
elevator_name: "In Station Elevator",
elevator_id: "112"
}
]
},
%ElevatorClosuresList.Station{
id: "place-test-no-redundancy",
name: "Other No Redundancy",
route_icons: [%{type: :text, text: "RL", color: :red}],
closures: [
%Screens.V2.WidgetInstance.Elevator.Closure{
%Closure{
id: "3",
elevator_name: "Other Without Redundancy",
elevator_id: "333",
Expand All @@ -321,7 +327,8 @@ defmodule Screens.V2.CandidateGenerator.Elevator.ClosuresTest do
}
]
}
]
],
station_id: "place-test"
},
^footer_instance
] =
Expand Down Expand Up @@ -424,16 +431,20 @@ defmodule Screens.V2.CandidateGenerator.Elevator.ClosuresTest do
^header_instance,
%ElevatorClosuresList{
app_params: ^config,
in_station_closures: [
%{
id: "1",
description: nil,
elevator_name: "Test",
elevator_id: "facility-test",
header_text: nil
stations_with_closures: [
%ElevatorClosuresList.Station{
id: "place-test",
name: "Place Test",
closures: [
%Closure{
id: "1",
elevator_name: "Test",
elevator_id: "facility-test"
}
]
}
],
other_stations_with_closures: []
station_id: "place-test"
},
^footer_instance
] =
Expand Down
17 changes: 4 additions & 13 deletions test/screens/v2/widget_instance/elevator_closures_list_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@ defmodule Screens.V2.WidgetInstance.ElevatorClosuresListTest do
alternate_direction_text: "Test",
accessible_path_direction_arrow: :n
),
in_station_closures: [
%Closure{
description: "Test Alert Description",
elevator_name: "Test Elevator",
elevator_id: "111",
id: "1",
header_text: "Test Alert Header"
}
],
other_stations_with_closures: [
stations_with_closures: [
%ElevatorClosuresList.Station{
name: "Forest Hills",
route_icons: ["Orange"],
Expand Down Expand Up @@ -52,9 +43,9 @@ defmodule Screens.V2.WidgetInstance.ElevatorClosuresListTest do
describe "serialize/1" do
test "returns map with id and closures", %{instance: instance} do
assert %{
in_station_closures: instance.in_station_closures,
other_stations_with_closures: instance.other_stations_with_closures,
id: instance.app_params.elevator_id
stations_with_closures: instance.stations_with_closures,
id: instance.app_params.elevator_id,
station_id: nil
} == WidgetInstance.serialize(instance)
end
end
Expand Down

0 comments on commit 131c756

Please sign in to comment.