<?php

declare(strict_types=1);

use App\Filament\Resources\ProviderConnectionResource;
use App\Models\User;

it('serves provider connections on the canonical tenantless route for workspace members', function (): void {
    [$user] = createUserWithTenant(role: 'owner');

    $this->actingAs($user)
        ->get('/admin/provider-connections')
        ->assertOk();

    expect(ProviderConnectionResource::getUrl('index', panel: 'admin'))
        ->toContain('/admin/provider-connections');
});

it('redirects non-workspace-members on the canonical tenantless route', function (): void {
    $user = User::factory()->create();

    $this->actingAs($user)
        ->get('/admin/provider-connections')
        ->assertRedirect();
});
