<?php

namespace Tests\Feature;

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

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

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

        $this->assertStringContainsString('data-role="recent-platform-orders-mini-bars"', $html);
        $this->assertStringContainsString('data-role="recent-platform-orders-mini-meta"', $html);
        $this->assertStringContainsString('data-points=', $html);
    }
}
