fix: join confirmation mail configuration
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon 2026-03-13 09:34:56 +01:00
parent a7481f6ab1
commit 40a4461d23
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
12 changed files with 167 additions and 28 deletions

View file

@ -0,0 +1,33 @@
defmodule Mv.Membership.JoinRequestSubmitEmailFailureTest do
@moduledoc """
Tests that when join confirmation email delivery fails, the domain returns
{:error, :email_delivery_failed} (and the LiveView shows an error). Uses
FailingMailAdapter to simulate delivery failure; async: false to avoid config races.
"""
use Mv.DataCase, async: false
alias Mv.Membership
@valid_submit_attrs %{
email: "fail#{System.unique_integer([:positive])}@example.com"
}
test "submit_join_request returns {:error, :email_delivery_failed} when mail delivery fails" do
saved = Application.get_env(:mv, Mv.Mailer)
Application.put_env(
:mv,
Mv.Mailer,
Keyword.put(saved || [], :adapter, Mv.TestSupport.FailingMailAdapter)
)
on_exit(fn ->
Application.put_env(:mv, Mv.Mailer, saved)
end)
token = "fail-token-#{System.unique_integer([:positive])}"
attrs = Map.put(@valid_submit_attrs, :confirmation_token, token)
assert {:error, :email_delivery_failed} = Membership.submit_join_request(attrs, actor: nil)
end
end