<?php

use App\Filament\Resources\OilPredictionResource\Pages\ListOilPredictions;
use App\Models\PricePrediction;
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 oil prediction list', function () {
    $predictions = PricePrediction::factory()->count(3)->create();

    Livewire::test(ListOilPredictions::class)
        ->assertOk()
        ->assertCanSeeTableRecords($predictions);
});

it('has a run prediction header action', function () {
    Livewire::test(ListOilPredictions::class)
        ->assertActionExists('runPrediction');
});
