<?php

declare(strict_types=1);

use Illuminate\Support\Facades\View;

it('renders template reference, badges, and readable timestamps in policy general cards', function () {
    $html = View::file(
        resource_path('views/filament/infolists/entries/policy-general.blade.php'),
        [
            'getState' => fn (): array => [
                'entries' => [
                    ['key' => 'Name', 'value' => 'WindowsFirewall Endpointsecurity'],
                    ['key' => 'Platforms', 'value' => 'windows10'],
                    ['key' => 'Technologies', 'value' => 'mdm,microsoftSense'],
                    ['key' => 'Template Reference', 'value' => [
                        'templateId' => '19c8aa67-f286-4861-9aa0-f23541d31680_1',
                        'templateFamily' => 'endpointSecurityFirewall',
                        'templateDisplayName' => 'Windows Firewall Rules',
                        'templateDisplayVersion' => 'Version 1',
                    ]],
                    ['key' => 'Last Modified', 'value' => '2026-01-03T00:52:32.2784312Z'],
                ],
            ],
        ],
    )->render();

    expect($html)->toContain('Windows Firewall Rules');
    expect($html)->toContain('Endpoint Security Firewall');
    expect($html)->toContain('Version 1');
    expect($html)->toContain('19c8aa67-f286-4861-9aa0-f23541d31680_1');

    expect($html)->toContain('mdm');
    expect($html)->toContain('microsoftSense');
    expect($html)->toContain('fi-badge');

    expect($html)->toContain('2026-01-03 00:52:32');
    expect($html)->not->toContain('T00:52:32.2784312Z');

    expect($html)->not->toContain('"templateId"');
});
