<?php

namespace Tests\Feature;

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

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

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

        // 图形化护栏：确保三个渐进增强容器存在（趋势 / 排行 / 占比）
        $res->assertSee('data-role="platform-order-trend-7d-chart"', false);
        $res->assertSee('data-role="merchant-revenue-rank-7d-chart"', false);
        $res->assertSee('data-role="plan-order-share-top5-chart"', false);
    }
}
