<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminPlatformOrderSummaryCardsShouldHaveJumpLinksTest extends TestCase
{
    use RefreshDatabase;

    protected function loginAsPlatformAdmin(): void
    {
        $this->seed();

        $this->post('/admin/login', [
            'email' => 'platform.admin@demo.local',
            'password' => 'Platform@123456',
        ])->assertRedirect('/admin');
    }

    public function test_platform_order_summary_cards_should_have_jump_links(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin/platform-orders');
        $res->assertOk();

        $html = (string) $res->getContent();
        $this->assertStringContainsString('data-role="po-summary-jump-links"', $html);
        $this->assertStringContainsString('href="#po-summary-card-paid-no-receipt"', $html);
        $this->assertStringContainsString('href="#po-summary-card-reconcile-mismatch"', $html);
        $this->assertStringContainsString('href="#po-summary-card-syncable"', $html);
        $this->assertStringContainsString('href="#po-summary-card-renewal-missing-sub"', $html);
    }
}
