<?php

use App\Filament\Resources\OperationRunResource;
use App\Models\OperationRun;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Queue;

it('does not enqueue work while rendering Monitoring → Operations', function () {
    [$user, $tenant] = createUserWithTenant(role: 'owner');

    OperationRun::factory()->create([
        'tenant_id' => $tenant->getKey(),
        'type' => 'policy.sync',
        'status' => 'queued',
        'outcome' => 'pending',
        'initiator_name' => 'System',
    ]);

    $this->actingAs($user);

    Bus::fake();
    Queue::fake();

    assertNoOutboundHttp(function () use ($tenant) {
        $this->get(OperationRunResource::getUrl('index', tenant: $tenant))
            ->assertOk();
    });

    Bus::assertNothingDispatched();
    Queue::assertNothingPushed();
});
