How to increase Pest test coverage

Hey, I am attempting to increase my test coverage to 100% for my resources and can't seem to figure it out. For context: - Larvel 10 - Filament v3 - PHP 8.2 - Pest 2.0 I currently have a User resource created with the panel builder and customised to my needs. I have the infolist, form & table methods all completed & the app is working as expected. The issue I have is I for the life of me cannot get my test coverage up on these methods. All my tests for rendering the views, asserting that the components contain the right data / number of rows pass. See examples below. But none of them help in getting the Pest coverage up. Example Pest coverage output. The lines suggested cover the 3 infolist, form & table methods Resources/UserResource ............. 35..105, 34..107 / 12.7% What am I missing? Ive tried several different techniques but can't seem to get the coverage up.
it('can render list', function () {
$this->get(UserResource::getUrl('index'))
->assertSeeLivewire(UserResource\Pages\ListUsers::class)
->assertSuccessful();
});

it('can retrieve data', function () {
$user = User::factory()->create();

livewire(UserResource\Pages\ViewUser::class, [
'record' => $user->getRouteKey(),
])
->assertSee([
$user->first_name,
$user->last_name,
$user->email,
$user->roleName
]);
});

it('can list users', function () {
User::factory()
->count(5)
->create();

livewire(UserResource\Pages\ListUsers::class)
->assertCanSeeTableRecords(User::all())
->assertCanRenderTableColumn('title');
});
it('can render list', function () {
$this->get(UserResource::getUrl('index'))
->assertSeeLivewire(UserResource\Pages\ListUsers::class)
->assertSuccessful();
});

it('can retrieve data', function () {
$user = User::factory()->create();

livewire(UserResource\Pages\ViewUser::class, [
'record' => $user->getRouteKey(),
])
->assertSee([
$user->first_name,
$user->last_name,
$user->email,
$user->roleName
]);
});

it('can list users', function () {
User::factory()
->count(5)
->create();

livewire(UserResource\Pages\ListUsers::class)
->assertCanSeeTableRecords(User::all())
->assertCanRenderTableColumn('title');
});
0 Replies
No replies yetBe the first to reply to this messageJoin