topnotch_website/tests/Unit/CustomerReportTest.php

21 lines
606 B
PHP
Raw Normal View History

<?php
2025-02-01 09:57:57 -08:00
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);
2025-02-01 09:57:57 -08:00
it('can render Customer Report pages', function () {
$this->actingAs(User::factory(['is_admin' => true])->create());
2025-02-01 09:57:57 -08:00
livewire(ListCustomerReports::class)->assertSuccessful();
});
it('cannot render the list page if user isn\'t an admin', function () {
$this->actingAs(User::factory()->create());
2025-02-01 09:57:57 -08:00
livewire(ListCustomerReports::class)->assertForbidden();
});