<?php

declare(strict_types=1);

use Tests\Support\TestLaneManifest;

it('wires the pull-request workflow only to the fast-feedback lane with the checked-in wrappers and artifact staging helper', function (): void {
    $workflowProfile = TestLaneManifest::workflowProfile('pr-fast-feedback');
    $workflowContents = (string) file_get_contents(repo_path($workflowProfile['filePath']));

    expect(file_exists(repo_path($workflowProfile['filePath'])))->toBeTrue()
        ->and($workflowProfile['triggerClass'])->toBe('pull-request')
        ->and($workflowProfile['laneBindings'])->toBe(['fast-feedback'])
        ->and($workflowContents)->toContain('pull_request:')
        ->and($workflowContents)->toContain('permissions:')
        ->and($workflowContents)->toContain('actions: read')
        ->and($workflowContents)->toContain('contents: read')
        ->and($workflowContents)->toContain('opened', 'reopened', 'synchronize')
        ->and($workflowContents)->toContain('./scripts/platform-test-lane fast-feedback --workflow-id=pr-fast-feedback --trigger-class=pull-request')
        ->and($workflowContents)->toContain('TENANTATLAS_GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}')
        ->and($workflowContents)->toContain('./scripts/platform-test-report fast-feedback --workflow-id=pr-fast-feedback --trigger-class=pull-request --fetch-latest-history')
        ->and($workflowContents)->toContain('./scripts/platform-test-artifacts fast-feedback .gitea-artifacts/pr-fast-feedback --workflow-id=pr-fast-feedback --trigger-class=pull-request')
        ->and($workflowContents)->toContain('name: fast-feedback-artifacts')
        ->and($workflowContents)->not->toContain('confidence --workflow-id=pr-fast-feedback', 'heavy-governance', 'browser --workflow-id=pr-fast-feedback');
});
