diff --git a/tests/Unit/Traits/Helpers/ColumnHelpersTest.php b/tests/Unit/Traits/Helpers/ColumnHelpersTest.php index 8239fcaf3..cfebce832 100644 --- a/tests/Unit/Traits/Helpers/ColumnHelpersTest.php +++ b/tests/Unit/Traits/Helpers/ColumnHelpersTest.php @@ -2,6 +2,8 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Unit\Traits\Helpers; +use Rappasoft\LaravelLivewireTables\Exceptions\NoColumnsException; +use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; use Rappasoft\LaravelLivewireTables\Tests\Models\Pet; use Rappasoft\LaravelLivewireTables\Tests\TestCase; use Rappasoft\LaravelLivewireTables\Views\Column; @@ -360,4 +362,27 @@ public function test_can_check_if_column_label_has_attributes(): void $this->assertSame(['class' => 'text-xl', 'default' => true, 'default-colors' => false, 'default-styling' => false], $column->getLabelAttributes()); } + + public function test_throws_error_if_no_columns_are_defined(): void + { + $this->expectException(NoColumnsException::class); + + $testTable = new class extends PetsTable + { + public function columns(): array + { + return []; + } + }; + + $testTable->configure(); + $testTable->boot(); + $testTable->bootedComponentUtilities(); + $testTable->bootedWithData(); + $testTable->bootedWithColumns(); + $testTable->bootedWithColumnSelect(); + $testTable->bootedWithSecondaryHeader(); + $testTable->booted(); + + } }