<?php

use App\Filament\Admin\Resources\CustomerReportResource\Pages\ListCustomerReports;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

use function Pest\Livewire\livewire;

uses(RefreshDatabase::class);

it('can render Customer Report pages', function () {
    $this->actingAs(User::factory(['is_admin' => true])->create());

    livewire(ListCustomerReports::class)->assertSuccessful();
});

it('cannot render the list page if user isn\'t an admin', function () {
    $this->actingAs(User::factory()->create());
    livewire(ListCustomerReports::class)->assertForbidden();
});
