diff --git a/.formatter.exs b/.formatter.exs index 3deae447..6ed409c0 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,5 @@ +# Used by "mix format" + locals_without_parens = [ dispatch: 2, identify: 2, @@ -6,8 +8,8 @@ locals_without_parens = [ [ inputs: [ - "lib/*/{lib,test}/**/*.{ex,exs}", - "lib/*/mix.exs" + "{mix,.formatter}.exs", + "{config,lib,test}/**/*.{ex,exs}" ], locals_without_parens: locals_without_parens, export: [locals_without_parens: locals_without_parens] diff --git a/lib/commanded/event_store/adapters/in_memory/subscription.ex b/lib/commanded/event_store/adapters/in_memory/subscription.ex index 29712be4..87bcfb2f 100644 --- a/lib/commanded/event_store/adapters/in_memory/subscription.ex +++ b/lib/commanded/event_store/adapters/in_memory/subscription.ex @@ -34,7 +34,7 @@ defmodule Commanded.EventStore.Adapters.InMemory.Subscription do end @impl GenServer - def handle_info({:DOWN, _ref, :process, pid, reason}, %Subscription{} = state) do + def handle_info({:DOWN, _ref, :process, _pid, reason}, %Subscription{} = state) do {:stop, reason, state} end end diff --git a/test/event_store/support/append_events_test_case.ex b/test/event_store/support/append_events_test_case.ex index 144a26de..f2d8ea52 100644 --- a/test/event_store/support/append_events_test_case.ex +++ b/test/event_store/support/append_events_test_case.ex @@ -13,13 +13,13 @@ defmodule Commanded.EventStore.AppendEventsTestCase do describe "append events to a stream" do test "should append events" do - assert :ok == EventStore.append_to_stream("stream", 0, build_events(2)) - assert :ok == EventStore.append_to_stream("stream", 2, build_events(2)) - assert :ok == EventStore.append_to_stream("stream", 4, build_events(1)) + assert :ok == EventStore.append_to_stream("stream", 0, build_events(1)) + assert :ok == EventStore.append_to_stream("stream", 1, build_events(2)) + assert :ok == EventStore.append_to_stream("stream", 3, build_events(3)) end - test "should append events without checking expected version" do - assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(2)) + test "should append events with `:any_version` without checking expected version" do + assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(3)) assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(2)) assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(1)) end @@ -35,34 +35,34 @@ defmodule Commanded.EventStore.AppendEventsTestCase do EventStore.append_to_stream("stream", :no_stream, build_events(1)) end - test "should append events with :stream_exists parameter" do + test "should append events with `:stream_exists` parameter" do assert :ok == EventStore.append_to_stream("stream", :no_stream, build_events(2)) assert :ok == EventStore.append_to_stream("stream", :stream_exists, build_events(1)) end - test "should fail when stream does not exists with :stream_exists parameter" do + test "should fail with `:stream_exists` parameter when stream does not exist" do assert {:error, :stream_does_not_exist} == EventStore.append_to_stream("stream", :stream_exists, build_events(1)) end - test "should fail to append to a stream because of wrong expected version when no previous events" do - events = build_events(1) - + test "should fail to append to a stream because of wrong expected version when no stream" do assert {:error, :wrong_expected_version} == - EventStore.append_to_stream("stream", 1, events) + EventStore.append_to_stream("stream", 1, build_events(1)) end test "should fail to append to a stream because of wrong expected version" do - assert :ok == EventStore.append_to_stream("stream", 0, build_events(2)) + assert :ok == EventStore.append_to_stream("stream", 0, build_events(3)) + + assert {:error, :wrong_expected_version} == + EventStore.append_to_stream("stream", 0, build_events(1)) assert {:error, :wrong_expected_version} == EventStore.append_to_stream("stream", 1, build_events(1)) - end - test "should append events to any version" do - assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(2)) - assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(2)) - assert :ok == EventStore.append_to_stream("stream", :any_version, build_events(1)) + assert {:error, :wrong_expected_version} == + EventStore.append_to_stream("stream", 2, build_events(1)) + + assert :ok == EventStore.append_to_stream("stream", 3, build_events(1)) end end