Fix tests after CLDR upgrade

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-10-27 16:08:15 +02:00
parent 2454fe2aa4
commit 082435129e
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -10,31 +10,31 @@ defmodule Mobilizon.Service.DateTimeTest do
describe "render a datetime to string" do describe "render a datetime to string" do
test "standard datetime" do test "standard datetime" do
{:ok, datetime, _} = DateTime.from_iso8601(@datetime) {:ok, datetime, _} = DateTime.from_iso8601(@datetime)
assert DateTimeTools.datetime_to_string(datetime) == "Jun 22, 2021, 3:25:29 PM" assert DateTimeTools.datetime_to_string(datetime) == "Jun 22, 2021, 3:25:29PM"
assert DateTimeTools.datetime_to_string(datetime, "fr") == "22 juin 2021, 15:25:29" assert DateTimeTools.datetime_to_string(datetime, "fr") == "22 juin 2021, 15:25:29"
assert DateTimeTools.datetime_to_string(datetime, "fr", :long) == assert DateTimeTools.datetime_to_string(datetime, "fr", :long) ==
"22 juin 2021 à 15:25:29 UTC" "22 juin 2021, 15:25:29 UTC"
end end
test "non existing or loaded locale fallbacks to english" do test "non existing or loaded locale fallbacks to english" do
{:ok, datetime, _} = DateTime.from_iso8601(@datetime) {:ok, datetime, _} = DateTime.from_iso8601(@datetime)
assert DateTimeTools.datetime_to_string(datetime, "es") == "Jun 22, 2021, 3:25:29 PM" assert DateTimeTools.datetime_to_string(datetime, "es") == "Jun 22, 2021, 3:25:29PM"
end end
end end
describe "render a time to string" do describe "render a time to string" do
test "standard time" do test "standard time" do
{:ok, datetime, _} = DateTime.from_iso8601(@datetime) {:ok, datetime, _} = DateTime.from_iso8601(@datetime)
assert DateTimeTools.datetime_to_time_string(datetime) == "3:25 PM" assert DateTimeTools.datetime_to_time_string(datetime) == "3:25PM"
assert DateTimeTools.datetime_to_time_string(datetime, "fr") == "15:25" assert DateTimeTools.datetime_to_time_string(datetime, "fr") == "15:25"
end end
test "non existing or loaded locale fallbacks to english" do test "non existing or loaded locale fallbacks to english" do
{:ok, datetime, _} = DateTime.from_iso8601(@datetime) {:ok, datetime, _} = DateTime.from_iso8601(@datetime)
assert DateTimeTools.datetime_to_time_string(datetime, "pl") == "3:25 PM" assert DateTimeTools.datetime_to_time_string(datetime, "pl") == "3:25PM"
end end
end end