<?php

declare(strict_types=1);

use App\Support\Filament\PanelThemeAsset;

it('resolves the built Filament admin theme from the manifest', function (): void {
    $asset = PanelThemeAsset::resolve('resources/css/filament/admin/theme.css');

    expect($asset)
        ->toContain('/build/assets/theme-')
        ->not->toContain(':5173');
});

it('injects the Livewire intercept shim into Filament pages', function (): void {
    $this->get('/admin/login')
        ->assertSuccessful()
        ->assertSee('js/tenantpilot/livewire-intercept-shim.js', escape: false);
});

it('ships a shim that waits for Livewire initialization', function (): void {
    $js = file_get_contents(public_path('js/tenantpilot/livewire-intercept-shim.js'));

    expect($js)->toBeString();
    expect($js)->toContain('livewire:init');
});
