Skip to content

Commit

Permalink
added test subscriber relation manager
Browse files Browse the repository at this point in the history
  • Loading branch information
199ocero committed Jun 4, 2024
1 parent 358fd8e commit d99729c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/Feature/EmailListResource/RelationManagerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use App\Filament\Admin\Resources\EmailListResource\Pages\EditEmailList;
use App\Filament\Admin\Resources\EmailListResource\RelationManagers\SubscribersRelationManager;
use App\Models\EmailList;
use App\Models\Subscriber;
use App\Models\Tag;

use function Pest\Livewire\livewire;

beforeEach(function () {
asUser();
});

it('can list email lists subscribers', function () {
$emailList = EmailList::factory()->has(Subscriber::factory()->count(3)->has(Tag::factory()->count(1)))->create();

livewire(SubscribersRelationManager::class, [
'ownerRecord' => $emailList,
'pageClass' => EditEmailList::class,
])
->loadTable()
->assertCanSeeTableRecords($emailList->subscribers)
->assertCountTableRecords($emailList->subscribers()->count());
});

0 comments on commit d99729c

Please sign in to comment.