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:
Ovidiu U
2026-04-04 14:31:02 +01:00
parent a3288955d8
commit 1d2eb12e83
3 changed files with 112 additions and 0 deletions

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