<?php

use App\Models\User;
use Livewire\Livewire;
use Modules\Booking\Filament\Widgets\RecentBookingsTableWidget;
use Modules\Booking\Models\Booking;

test('it lists the most recently created bookings', function () {
    $this->actingAs(User::factory()->create());

    $older = Booking::factory()->create(['created_at' => now()->subDay()]);
    $newer = Booking::factory()->create(['created_at' => now()]);

    Livewire::test(RecentBookingsTableWidget::class)
        ->assertOk()
        ->assertCanSeeTableRecords([$newer, $older]);
});
