You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/test/plausible/timezones_test.exs

20 lines
662 B
Elixir

defmodule Plausible.TimezonesTest do
use ExUnit.Case, async: true
test "options/0 returns a list of timezones" do
options = Plausible.Timezones.options()
refute Enum.empty?(options)
gmt12 = Enum.find(options, &(&1[:value] == "Etc/GMT+12"))
assert [key: "(GMT-12:00) Etc/GMT+12", value: "Etc/GMT+12", offset: 720] = gmt12
hawaii = Enum.find(options, &(&1[:value] == "US/Hawaii"))
assert [key: "(GMT-10:00) US/Hawaii", value: "US/Hawaii", offset: 600] = hawaii
end
test "options/0 does not fail during time changes" do
options = Plausible.Timezones.options(~N[2021-10-03 02:31:07])
refute Enum.empty?(options)
end
end