Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(application): only show server warning for false status

Andras Bacsai37a99e5f94cf
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 3413b3671c..80c786a3eb 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 @@
<span>
- @if ($application->server_status == false)
+ @if ($application->server_status === false)
<span title="One or more servers are unreachable or misconfigured.">
<svg class="w-4 h-4 text-error" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
diff --git a/tests/Feature/ApplicationServerStatusBadgeTest.php b/tests/Feature/ApplicationServerStatusBadgeTest.php
new file mode 100644
index 0000000000..2596752ebd
--- /dev/null
+++ b/tests/Feature/ApplicationServerStatusBadgeTest.php
@@ -0,0 +1,42 @@
+<?php
+
+function renderApplicationServerStatusBadge(?bool $serverStatus, string $status = 'running', bool $hasAdditionalServers = false): string
+{
+ $application = new class($serverStatus, $status, $hasAdditionalServers)
+ {
+ public function __construct(
+ public ?bool $server_status,
+ public string $status,
+ private bool $hasAdditionalServers,
+ ) {}
+
+ public function additional_servers(): object
+ {
+ return new class($this->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.');
+});