<?php

namespace FluxCms\Core\Tests\Unit\Admin;

use FluxCms\Core\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Orchestra\Testbench\TestCase;

class DashboardControllerTest extends TestCase
{
    use RefreshDatabase;

    protected User $adminUser;

    protected function setUp(): void
    {
        parent::setUp();
        $this->adminUser = User::factory()->create(['is_admin' => true]);
        $this->actingAs($this->adminUser);
    }

    public function test_admin_can_see_dashboard()
    {
        $response = $this->get(route('admin.cms.index'));
        $response->assertOk();
        $response->assertViewHas('stats');
        $response->assertViewHas('recentPages');
    }
}
