Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulJKim committed Sep 19, 2023
1 parent e59c451 commit 23272e0
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions test/content/messages/predictions_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ defmodule Content.Message.PredictionsTest do
import ExUnit.CaptureLog

describe "non_terminal/3" do
@sign %{source_config: nil}

test "logs a warning when we cant find a headsign" do
prediction = %Predictions.Prediction{
seconds_until_arrival: 0,
Expand All @@ -15,7 +17,7 @@ defmodule Content.Message.PredictionsTest do

log =
capture_log([level: :warn], fn ->
assert is_nil(Content.Message.Predictions.non_terminal(prediction, "test", "m"))
assert is_nil(Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign))
end)

assert log =~ "no_destination_for_prediction"
Expand All @@ -31,7 +33,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70261"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont ARR"
end
Expand All @@ -46,7 +48,7 @@ defmodule Content.Message.PredictionsTest do
boarding_status: "Boarding"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont BRD"
end
Expand All @@ -61,7 +63,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70275"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Mattapan ARR"
end
Expand All @@ -76,7 +78,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70275"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Mattapan 1 min"
end
Expand All @@ -91,7 +93,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70275"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Mattapan 1 min"
end
Expand All @@ -107,7 +109,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70275"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Mattapan 20+ min"
end
Expand All @@ -122,7 +124,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70275"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", nil, 15)
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign, nil, 15)
assert Content.Message.to_string(msg) == "Mattapan 9 min"
end

Expand All @@ -136,7 +138,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70261"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont 1 min"
end
Expand All @@ -151,7 +153,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70261"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont 2 min"
end
Expand All @@ -166,7 +168,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70261"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont ARR"
end
Expand All @@ -181,7 +183,7 @@ defmodule Content.Message.PredictionsTest do
boarding_status: "Boarding"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont BRD"
end
Expand All @@ -196,7 +198,7 @@ defmodule Content.Message.PredictionsTest do
destination_stop_id: "70261"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert Content.Message.to_string(msg) == "Ashmont 2 min"
end
Expand All @@ -212,7 +214,7 @@ defmodule Content.Message.PredictionsTest do
trip_id: "trip1"
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert msg.trip_id == "trip1"
end
Expand All @@ -228,7 +230,7 @@ defmodule Content.Message.PredictionsTest do
new_cars?: true
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert msg.new_cars?
end
Expand All @@ -243,7 +245,7 @@ defmodule Content.Message.PredictionsTest do
stops_away: 2
}

msg = Content.Message.Predictions.non_terminal(prediction, "RJFK", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "RJFK", "m", @sign)

assert Content.Message.to_string(msg) == [
{"Alewife (A) 5 min", 6},
Expand All @@ -261,7 +263,7 @@ defmodule Content.Message.PredictionsTest do
stops_away: 2
}

msg = Content.Message.Predictions.non_terminal(prediction, "RJFK", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "RJFK", "m", @sign)

assert Content.Message.to_string(msg) == [
{"Alewife (B) 5 min", 6},
Expand All @@ -279,7 +281,7 @@ defmodule Content.Message.PredictionsTest do
stops_away: 2
}

msg = Content.Message.Predictions.non_terminal(prediction, "RJFK", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "RJFK", "m", @sign)

assert Content.Message.to_string(msg) == [
{"Alewife 6 min", 6},
Expand Down Expand Up @@ -434,7 +436,7 @@ defmodule Content.Message.PredictionsTest do
new_cars?: true
}

msg = Content.Message.Predictions.non_terminal(prediction, "test", "m")
msg = Content.Message.Predictions.non_terminal(prediction, "test", "m", @sign)

assert msg.new_cars?
end
Expand Down

0 comments on commit 23272e0

Please sign in to comment.