feat: add StationResource with poll action and view page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-04 14:27:22 +01:00
parent b2cc3ee0ff
commit 52dc225b3d
4 changed files with 206 additions and 0 deletions

View 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');
});