@Sinnbeck following your advice, I've modified the columns in my table
Like this :
Tables\Columns\TextColumn::make('type')
->label(__('rates.type'))
->formatStateUsing(fn(TypeEnum $state): string => $state->getLabel())
->sortable(['id', 'type'])
->searchable(),
Tables\Columns\TextColumn::make('category')
->label(__('rates.category'))
->formatStateUsing(fn(CategoryEnum $state): string => $state->getLabel())
->sortable(['id', 'category'])
->searchable(),
But my test wipe again
it('can sort rates by category', function () {
livewire(ManageRates::class)
->assertCanSeeTableRecords($this->rates)
->assertTableColumnFormattedStateSet('category', $this->rate->category->getLabel(), record: $this->rate)
->assertTableColumnFormattedStateNotSet('category', $this->rate->category->value, record: $this->rate)
->sortTable('category')
->assertCanSeeTableRecords($this->rates->sortBy([['id', 'asc'],['category', 'asc']]), inOrder: true)
->sortTable('category', 'desc')
->assertCanSeeTableRecords($this->rates->sortByDesc([['id', 'desc'],['category', 'desc']]), inOrder: true);
})->only();
Did you see what I'm doing wrong?