From 42399ab095f206feec5a6d94e77056e6b2ec94cf Mon Sep 17 00:00:00 2001 From: Benjamin Moss Date: Sun, 1 Dec 2024 20:19:06 -0500 Subject: [PATCH] Don't use :day and :hour times as 1.13 doesn't support them yet --- test/event_store_test.exs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/event_store_test.exs b/test/event_store_test.exs index 66aa64e..630c077 100644 --- a/test/event_store_test.exs +++ b/test/event_store_test.exs @@ -8,6 +8,9 @@ defmodule EventStore.EventStoreTest do @all_stream "$all" @subscription_name "test_subscription" + @an_hour 60 * 60 * 1000 + @a_day 24 * @an_hour + test "returns already started for started event store" do assert {:error, {:already_started, _}} = EventStore.start_link() end @@ -204,7 +207,7 @@ defmodule EventStore.EventStoreTest do end test "override created_at" do - created_at = DateTime.utc_now() |> DateTime.add(-1, :day) + created_at = DateTime.utc_now() |> DateTime.add(-1 * @a_day) stream_uuid = UUID.uuid4() events = EventFactory.create_events(1) @@ -218,8 +221,8 @@ defmodule EventStore.EventStoreTest do end test "override created_at existing stream" do - created_at = DateTime.utc_now() |> DateTime.add(-1, :day) - created_at2 = DateTime.utc_now() |> DateTime.add(-1, :hour) + created_at = DateTime.utc_now() |> DateTime.add(-1 * @a_day) + created_at2 = DateTime.utc_now() |> DateTime.add(-1 * @an_hour) stream_uuid = UUID.uuid4() events = EventFactory.create_events(1) events2 = EventFactory.create_events(1) @@ -240,7 +243,7 @@ defmodule EventStore.EventStoreTest do end test "override created_at any_version" do - created_at = DateTime.utc_now() |> DateTime.add(-1, :day) + created_at = DateTime.utc_now() |> DateTime.add(-1 * @a_day) stream_uuid = UUID.uuid4() events = EventFactory.create_events(1) @@ -257,8 +260,8 @@ defmodule EventStore.EventStoreTest do end test "override created_at any_version existing stream" do - created_at = DateTime.utc_now() |> DateTime.add(-1, :day) - created_at2 = DateTime.utc_now() |> DateTime.add(-1, :hour) + created_at = DateTime.utc_now() |> DateTime.add(-1 * @a_day) + created_at2 = DateTime.utc_now() |> DateTime.add(-1 * @an_hour) stream_uuid = UUID.uuid4() events = EventFactory.create_events(1) events2 = EventFactory.create_events(1)