<?php

use App\Models\User;
use Livewire\Livewire;
use Modules\Booking\Enums\BookingStatus;
use Modules\Booking\Filament\Widgets\BookingsTodayWidget;
use Modules\Booking\Models\Booking;

test('it counts todays trips by status, ignoring other days', function () {
    $this->actingAs(User::factory()->create());

    Booking::factory()->create(['travel_date' => today(), 'status' => BookingStatus::Confirmed]);
    Booking::factory()->create(['travel_date' => today(), 'status' => BookingStatus::PendingPayment]);
    Booking::factory()->create(['travel_date' => today()->addDay(), 'status' => BookingStatus::Confirmed]);

    Livewire::test(BookingsTodayWidget::class)
        ->assertOk()
        ->assertSee('Trips Today')
        ->assertSee('2')
        ->assertSee('Confirmed')
        ->assertSee('Awaiting Payment');
});
