add send test email button to campaign form
All checks were successful
deploy / deploy (push) Successful in 1m22s
All checks were successful
deploy / deploy (push) Successful in 1m22s
Sends the campaign to the admin's own email address as a preview, with [Test] prefix in subject line. Uses the same HTML template and formatting as real sends. Does not affect campaign status or sent counts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,21 @@ defmodule Berrypod.Newsletter.NotifierTest do
|
||||
end
|
||||
end
|
||||
|
||||
describe "deliver_test/2" do
|
||||
test "sends test email with [Test] prefix in subject" do
|
||||
campaign = campaign_fixture(subject: "Big launch", body: "Preview this!\n\n{{unsubscribe_url}}")
|
||||
|
||||
assert {:ok, _} = Notifier.deliver_test(campaign, "admin@example.com")
|
||||
|
||||
assert_email_sent(fn email ->
|
||||
assert email.to == [{"", "admin@example.com"}]
|
||||
assert email.subject == "[Test] Big launch"
|
||||
assert email.text_body =~ "Preview this!"
|
||||
assert email.html_body =~ "<!DOCTYPE html>"
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
describe "text_to_html/1" do
|
||||
test "wraps paragraphs split by blank lines" do
|
||||
html = Notifier.text_to_html("First paragraph.\n\nSecond paragraph.")
|
||||
|
||||
Reference in New Issue
Block a user