toContain('and($view)->toContain("['value' => 'vultr', 'label' => 'Vultr']") ->and($view)->toContain("['value' => 'digitalocean', 'label' => 'DigitalOcean']") ->and($view)->toContain("['value' => 'hostinger', 'label' => 'Hostinger']") ->and(substr_count($view, 'https://console.vultr.com/user/apiaccess/'))->toBe(1) ->and($view)->not->toContain('cloudProviderTokens->where(\'provider\', $provider)->isEmpty()') ->and($view)->not->toContain('') ->and($component)->toContain("'provider' => 'required|string|in:hetzner,digitalocean,vultr,hostinger'"); }); it('keeps provider affiliate links on server provider views', function () { $tokenFormView = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token-form.blade.php'); $hetznerView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/new/by-hetzner.blade.php'); $vultrView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/new/by-vultr.blade.php'); $digitalOceanView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/new/by-digital-ocean.blade.php'); expect($tokenFormView) ->not->toContain('https://coolify.io/hetzner') ->not->toContain('https://coolify.io/vultr') ->and($hetznerView)->toContain('https://coolify.io/hetzner') ->and($vultrView)->toContain('https://coolify.io/vultr') ->and($digitalOceanView)->toContain('https://coolify.io/digitalocean'); }); it('uses the shared modal form on the cloud provider tokens page', function () { $view = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-tokens.blade.php'); expect($view)->toContain('New token') ->and($view)->toContain('and($view)->toContain('and($view)->toContain("\$savedToken->provider === 'digitalocean' ? 'DigitalOcean' : ucfirst(\$savedToken->provider)") ->and($view)->not->toContain('

New Token

') ->and($view)->not->toContain(':modal_mode="false"') ->and($view)->not->toContain('wire:click="validateToken') ->and($view)->not->toContain('submitAction="deleteToken') ->and($view)->not->toContain('Created {{ $savedToken->created_at->diffForHumans() }}'); }); it('gates new cloud tokens and keys saved token rows by id', function () { $view = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-tokens.blade.php'); expect($view)->toContain("@can('create', App\\Models\\CloudProviderToken::class)") ->and($view)->toContain('wire:key="cloud-token-{{ $savedToken->id }}"'); }); it('gates the server cloud token action behind the update permission', function () { $serverTokenView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/cloud-provider-token/show.blade.php'); expect($serverTokenView)->toContain('