['status' => 'down', 'connection' => 'mysql', 'message' => 'Connection refused'], 'database_arcadia' => ['status' => 'up', 'connection' => 'arcadia'], ]; // WHEN $mail = new SystemHealthAlertMail( status: HealthStatus::UNHEALTHY, occurredAt: $occurredAt, checks: $checks, previousStatus: HealthStatus::HEALTHY, ); $envelope = $mail->envelope(); $content = $mail->content(); // THEN expect($envelope->subject)->toBe('[Arcadia Health] 🛑 System Health Alert - Component DOWN') ->and($content->markdown)->toBe('mails.health-alert') ->and($content->with['status'])->toBe('unhealthy') ->and($content->with['isRecovery'])->toBeFalse() ->and($content->with['previousStatus'])->toBe('healthy') ->and($content->with['checksJson'])->toContain('Connection refused'); }); it('constructs recovery mail with recovery subject and json markdown content', function (): void { // GIVEN $occurredAt = new \DateTimeImmutable('2026-08-26 12:05:00 UTC'); $checks = [ 'database_default' => ['status' => 'up', 'connection' => 'mysql'], 'database_arcadia' => ['status' => 'up', 'connection' => 'arcadia'], ]; // WHEN $mail = new SystemHealthAlertMail( status: HealthStatus::HEALTHY, occurredAt: $occurredAt, checks: $checks, previousStatus: HealthStatus::UNHEALTHY, ); $envelope = $mail->envelope(); $content = $mail->content(); // THEN expect($envelope->subject)->toBe('[Arcadia Health] 🟢 System Health Recovered- Component UP') ->and($content->markdown)->toBe('mails.health-alert') ->and($content->with['status'])->toBe('healthy') ->and($content->with['isRecovery'])->toBeTrue() ->and($content->with['previousStatus'])->toBe('unhealthy'); }); });