<?php

namespace Tests\Feature;

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

class AdminDashboardPlanOrderShareTop5MetaShouldIncludeOtherPctTest 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_dashboard_plan_order_share_top5_meta_should_include_other_pct(): void
    {
        $this->loginAsPlatformAdmin();

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

        // Top5 占比卡摘要行应包含“其它”占比（100%-覆盖率），避免运营误读 Top5=全部。
        $res->assertSee('data-role="plan-order-share-top5-meta"', false);
        $res->assertSee('其它：', false);
        $res->assertSee('%', false);
    }
}
