FilamentF
Filament6mo ago
Exi

"reorderRecords" action not found when testing a reorderable table

Filament v4 (Beta 15)

My CategoriesResource table has reordering enabled:

Table::make()
    ->reorderable('sort_order');


In my test I try to assert the reorder action exists / trigger it:

livewire(ListCategories::class)
    ->assertCanSeeTableRecords($categories)
    ->callAction('reorderRecords');          // also tried TestAction::make('reorderRecords')->table()


but I get:

Action [reorderRecords] not found on table.


What’s the correct way to test (or at least assert the presence of) the reorder action produced by reorderable()?
Solution
livewire(ListCategories::class)
            ->tap(function (Testable $testable): void {
                /** @var ListCategories $livewire */
                $livewire = $testable->instance();

                $table = $livewire->getTable();

                expect($table)
                    ->isReorderAuthorized()->toBeTrue();
            });


works for me
Was this page helpful?