fix: join confirmation mail configuration
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a7481f6ab1
commit
40a4461d23
12 changed files with 167 additions and 28 deletions
33
test/membership/join_request_submit_email_failure_test.exs
Normal file
33
test/membership/join_request_submit_email_failure_test.exs
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue