33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Server;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Blade;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* The command palette (Strg/⌘ K) must let you jump to a server. The Blade side feeds the
|
|
* fleet into the Alpine `cmdk` x-data; the JS filters it by name OR IP.
|
|
*/
|
|
class CommandPaletteServerSearchTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_palette_payload_includes_fleet_servers_with_details_href(): void
|
|
{
|
|
$server = Server::create(['name' => 'mars', 'ip' => '10.9.9.9', 'ssh_port' => 22, 'status' => 'online']);
|
|
|
|
$html = Blade::render('<x-command-palette />');
|
|
|
|
// Name (label + search), IP (hint + search) and the details href all reach the x-data.
|
|
$this->assertStringContainsString('mars', $html);
|
|
$this->assertStringContainsString('10.9.9.9', $html);
|
|
// @js() emits a JS-escaped string literal, so assert on the (unescaped) uuid that
|
|
// the details href is built from, plus the route segment it lands on.
|
|
$this->assertStringContainsString($server->uuid, $html);
|
|
$this->assertStringContainsString('servers', $html);
|
|
}
|
|
}
|