Skip to content

Commit

Permalink
Backoffice : trier les contacts lors de l'export
Browse files Browse the repository at this point in the history
Stabilise le test et rend le comportement de l'export plus prévisible pour un
humain.
  • Loading branch information
ptitfred committed Nov 27, 2024
1 parent 0ccce57 commit 4cff2f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ defmodule TransportWeb.Backoffice.ContactController do
left join notification_subscription ns_reuser on ns_reuser.contact_id = c.id and ns_reuser.role = 'reuser'
group by 1
) t on t.contact_id = id
order by id
"""

csv_header =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ defmodule TransportWeb.Backoffice.ContactControllerTest do

assert Enum.count(csv_content) == 2

assert [relevant, irrelevant] = csv_content

assert %{
"id" => to_string(contact.id),
"first_name" => contact.first_name,
Expand Down Expand Up @@ -365,10 +367,10 @@ defmodule TransportWeb.Backoffice.ContactControllerTest do
"reuser_resources_changed" => "false",
"is_producer" => "true",
"is_reuser" => "false"
} == csv_content |> hd()
} == relevant

# `array_agg` with only null values is properly encoded
assert %{"organization_names" => ""} = Enum.at(csv_content, 1)
assert %{"organization_names" => ""} = irrelevant
end

defp sample_contact_args(%{} = args \\ %{}) do
Expand Down

0 comments on commit 4cff2f7

Please sign in to comment.