feat: add StationResource with poll action and view page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
37
tests/Feature/Admin/StationResourceTest.php
Normal file
37
tests/Feature/Admin/StationResourceTest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use App\Filament\Resources\StationResource\Pages\ListStations;
|
||||
use App\Models\Station;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
$this->admin = User::factory()->admin()->create();
|
||||
$this->actingAs($this->admin);
|
||||
});
|
||||
|
||||
it('renders the station list', function () {
|
||||
$stations = Station::factory()->count(3)->create();
|
||||
|
||||
Livewire::test(ListStations::class)
|
||||
->assertOk()
|
||||
->assertCanSeeTableRecords($stations);
|
||||
});
|
||||
|
||||
it('filters to supermarkets only', function () {
|
||||
$regular = Station::factory()->create(['is_supermarket' => false]);
|
||||
$super = Station::factory()->supermarket()->create();
|
||||
|
||||
Livewire::test(ListStations::class)
|
||||
->filterTable('is_supermarket', true)
|
||||
->assertCanSeeTableRecords([$super])
|
||||
->assertCanNotSeeTableRecords([$regular]);
|
||||
});
|
||||
|
||||
it('has a trigger full poll header action', function () {
|
||||
Livewire::test(ListStations::class)
|
||||
->assertActionExists('triggerFullPoll');
|
||||
});
|
||||
Reference in New Issue
Block a user