commit 4988a98469d04b113a26b02f98841bf839523d32 parent aac8a34527647b19b9a5a77d14a1546cbf728b48 Author: srfsh <dev@srf.sh> Date: Sun, 14 Aug 2022 12:52:17 +0300 ZenflowsTest.Help.Factory: add now/0 and iso_now/0 They are easier to type and we'll be useful in tests. Diffstat:
M | test/help/factory.ex | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/test/help/factory.ex b/test/help/factory.ex @@ -25,6 +25,18 @@ alias Zenflows.VF defdelegate id(), to: Zenflows.DB.ID, as: :gen +@doc "Returns `DateTime.utc_now/0`." +@spec now() :: DateTime.t() +def now() do + DateTime.utc_now() +end + +@doc "Like `now/0`, but piped to `DateTime.to_iso8601/1`." +@spec iso_now() :: String.t() +def iso_now() do + now() |> DateTime.to_iso8601() +end + @doc """ Returns the same string with a unique positive integer attached at the end.