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>
27 lines
793 B
PHP
27 lines
793 B
PHP
<?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();
|
|
});
|