From dff7d9b08f2cf92d3157fb887dc057d06e8fc6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20Falco=CC=81n?= Date: Sat, 4 Jul 2026 20:34:24 +0200 Subject: [PATCH] test(drip): cover reply-to hook and all eight drip senders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The drip-sender parity test only exercised six of the eight mailables, and nothing asserted PaywallFollowUpEmail's reply-to — a behavior the refactor moved behind the repliesToSender() hook, so a regression there would have been silent. Extend the sender dataset to all eight drip mailables and add a test asserting that PaywallFollowUpEmail replies back to the drip sender address while a default drip mail (WelcomeEmail) sets no reply-to. --- tests/Feature/MailSenderTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/Feature/MailSenderTest.php b/tests/Feature/MailSenderTest.php index c78351fb..678da3e0 100644 --- a/tests/Feature/MailSenderTest.php +++ b/tests/Feature/MailSenderTest.php @@ -3,9 +3,11 @@ use App\Mail\BankingConnectionAuthFailedEmail; use App\Mail\BankTransactionsSyncedEmail; use App\Mail\BrokenBankLogosReportEmail; +use App\Mail\Drip\AiConsentFollowUpEmail; use App\Mail\Drip\FeedbackEmail; use App\Mail\Drip\ImportHelpEmail; use App\Mail\Drip\OnboardingReminderEmail; +use App\Mail\Drip\PaywallFollowUpEmail; use App\Mail\Drip\PromoCodeEmail; use App\Mail\Drip\SubscriptionCancelledEmail; use App\Mail\Drip\WelcomeEmail; @@ -84,24 +86,37 @@ test('drip mailables use the drip sender', function (string $mailableClass) { $user = User::factory()->create(); $mailable = match ($mailableClass) { + AiConsentFollowUpEmail::class => new AiConsentFollowUpEmail($user), WelcomeEmail::class => new WelcomeEmail($user), FeedbackEmail::class => new FeedbackEmail($user), ImportHelpEmail::class => new ImportHelpEmail($user), OnboardingReminderEmail::class => new OnboardingReminderEmail($user), + PaywallFollowUpEmail::class => new PaywallFollowUpEmail($user), PromoCodeEmail::class => new PromoCodeEmail($user), SubscriptionCancelledEmail::class => new SubscriptionCancelledEmail($user), }; expect($mailable->envelope()->from)->toEqual(new Address('hi@whisper.money', 'Álvaro and Víctor')); })->with([ + AiConsentFollowUpEmail::class, WelcomeEmail::class, FeedbackEmail::class, ImportHelpEmail::class, OnboardingReminderEmail::class, + PaywallFollowUpEmail::class, PromoCodeEmail::class, SubscriptionCancelledEmail::class, ]); +test('only the paywall follow-up sets a reply-to, back to the drip sender', function () { + $user = User::factory()->create(); + + expect((new PaywallFollowUpEmail($user))->envelope()->replyTo) + ->toEqual([new Address('hi@whisper.money', 'Álvaro and Víctor')]); + + expect((new WelcomeEmail($user))->envelope()->replyTo)->toBe([]); +}); + test('default sender is used for active non-drip mailables', function (string $mailableClass) { $user = User::factory()->create();