feat: add StatsOverviewWidget to admin dashboard
Four-stat overview widget (users, stations, oil prediction, API errors) with 30s polling registered on the admin panel dashboard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
26
tests/Feature/Admin/StatsOverviewWidgetTest.php
Normal file
26
tests/Feature/Admin/StatsOverviewWidgetTest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use App\Filament\Widgets\StatsOverviewWidget;
|
||||
use App\Models\ApiLog;
|
||||
use App\Models\PricePrediction;
|
||||
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 stats overview widget', function () {
|
||||
User::factory()->count(3)->create();
|
||||
Station::factory()->count(2)->create();
|
||||
PricePrediction::factory()->create(['generated_at' => now()->subHours(2)]);
|
||||
ApiLog::factory()->count(2)->create(['status_code' => 200, 'error' => null, 'created_at' => now()->subMinutes(30)]);
|
||||
|
||||
Livewire::test(StatsOverviewWidget::class)
|
||||
->assertOk();
|
||||
});
|
||||
Reference in New Issue
Block a user