File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
lib/astarte/common/generators
test/astarte/common/generators Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,11 @@ defmodule Astarte.Common.Generators.DateTime do
3030
3131 @ doc false
3232 @ spec min_default :: DateTime . t ( )
33- def min_default , do: TimestampGenerator . min_default ( ) |> DateTime . from_unix! ( @ ref_unit )
33+ def min_default , do: TimestampGenerator . min_default ( @ ref_unit ) |> DateTime . from_unix! ( @ ref_unit )
3434
3535 @ doc false
3636 @ spec max_default :: DateTime . t ( )
37- def max_default , do: TimestampGenerator . max_default ( ) |> DateTime . from_unix! ( @ ref_unit )
37+ def max_default , do: TimestampGenerator . max_default ( @ ref_unit ) |> DateTime . from_unix! ( @ ref_unit )
3838
3939 @ doc """
4040 Generates a random DateTime from min to max (see Timestamp generator)
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ defmodule Astarte.Common.Generators.DateTimeTest do
2424 use ExUnitProperties
2525
2626 alias Astarte.Common.Generators.DateTime , as: DateTimeGenerator
27+ alias Astarte.Common.Generators.Timestamp , as: TimestampGenerator
2728
2829 @ moduletag :common
2930 @ moduletag :datetime
@@ -53,5 +54,17 @@ defmodule Astarte.Common.Generators.DateTimeTest do
5354 assert DateTime . after? ( to , from )
5455 end
5556 end
57+
58+ @ tag :issue
59+ test "min equals to Timestamp min" do
60+ min = TimestampGenerator . min_default ( :microsecond ) |> DateTime . from_unix! ( :microsecond )
61+ assert min == DateTimeGenerator . min_default ( )
62+ end
63+
64+ @ tag :issue
65+ test "max equals to Timestamp max" do
66+ max = TimestampGenerator . max_default ( :microsecond ) |> DateTime . from_unix! ( :microsecond )
67+ assert max == DateTimeGenerator . max_default ( )
68+ end
5669 end
5770end
You can’t perform that action at this time.
0 commit comments