<?php

declare(strict_types=1);

use App\Jobs\CaptureBaselineSnapshotJob;
use App\Jobs\CompareBaselineToTenantJob;
use App\Models\OperationRun;

it('keeps baseline jobs within a safe queue timeout and retry window', function (): void {
    $captureJob = new CaptureBaselineSnapshotJob(new OperationRun);
    $compareJob = new CompareBaselineToTenantJob(new OperationRun);

    $databaseRetryAfter = (int) config('queue.connections.database.retry_after');
    $maximumJobTimeout = max($captureJob->timeout, $compareJob->timeout);

    expect($captureJob->timeout)->toBe(300)
        ->and($compareJob->timeout)->toBe(300)
        ->and($databaseRetryAfter)->toBeGreaterThan($maximumJobTimeout)
        ->and($databaseRetryAfter)->toBeGreaterThanOrEqual(600);
});
