Refactoring of Events context
This commit is contained in:
@@ -46,13 +46,13 @@ defmodule MobilizonWeb.API.SearchTest do
|
||||
|
||||
test "search events" do
|
||||
with_mock Events,
|
||||
find_and_count_events_by_name: fn "toto", 1, 10 ->
|
||||
build_events_by_name: fn "toto", 1, 10 ->
|
||||
%Page{total: 1, elements: [%Event{title: "super toto event"}]}
|
||||
end do
|
||||
assert {:ok, %{total: 1, elements: [%Event{title: "super toto event"}]}} =
|
||||
Search.search_events("toto", 1, 10)
|
||||
|
||||
assert_called(Events.find_and_count_events_by_name("toto", 1, 10))
|
||||
assert_called(Events.build_events_by_name("toto", 1, 10))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -197,7 +197,9 @@ defmodule MobilizonWeb.Resolvers.ReportResolverTest do
|
||||
assert json_response(res, 200)["data"]["reports"]
|
||||
|> Enum.map(fn report -> Map.get(report, "id") end)
|
||||
|> Enum.sort() ==
|
||||
Enum.map([report_1_id, report_2_id, report_3_id], &to_string/1)
|
||||
[report_1_id, report_2_id, report_3_id]
|
||||
|> Enum.map(&to_string/1)
|
||||
|> Enum.sort()
|
||||
|
||||
query = """
|
||||
{
|
||||
|
||||
@@ -39,9 +39,7 @@ defmodule MobilizonWeb.Resolvers.TagResolverTest do
|
||||
|> Enum.map(fn tag -> tag["slug"] end)
|
||||
|> MapSet.new() ==
|
||||
[tag2, tag3]
|
||||
|> Enum.map(fn
|
||||
tag -> tag.slug
|
||||
end)
|
||||
|> Enum.map(fn tag -> tag.slug end)
|
||||
|> MapSet.new()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user