From 37a99e5f94cfd4e1e8cf2eee2617bfb8aa4d0cb9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 28 May 2026 20:50:14 +0200 Subject: [PATCH] fix(application): only show server warning for false status Treat unknown server status separately from false so the unreachable badge is not shown until a server is confirmed unreachable. Add feature coverage for the badge rendering. --- .../application/server-status-badge.blade.php | 2 +- .../ApplicationServerStatusBadgeTest.php | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/ApplicationServerStatusBadgeTest.php diff --git a/resources/views/livewire/project/application/server-status-badge.blade.php b/resources/views/livewire/project/application/server-status-badge.blade.php index 3413b3671..80c786a3e 100644 --- a/resources/views/livewire/project/application/server-status-badge.blade.php +++ b/resources/views/livewire/project/application/server-status-badge.blade.php @@ -1,5 +1,5 @@ - @if ($application->server_status == false) + @if ($application->server_status === false) hasAdditionalServers) + { + public function __construct(private bool $exists) {} + + public function exists(): bool + { + return $this->exists; + } + }; + } + }; + + return view('livewire.project.application.server-status-badge', [ + 'application' => $application, + ])->render(); +} + +it('does not show the unreachable server badge when server status is unknown', function () { + $html = renderApplicationServerStatusBadge(null); + + expect($html)->not->toContain('One or more servers are unreachable or misconfigured.'); +}); + +it('shows the unreachable server badge only when server status is false', function () { + $html = renderApplicationServerStatusBadge(false); + + expect($html)->toContain('One or more servers are unreachable or misconfigured.'); +});