TenantAtlas/apps/platform/tests/Feature/Guards/TestLaneManifestTest.php
2026-04-16 15:57:39 +02:00

64 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
use Tests\Support\TestLaneManifest;
it('declares the six checked-in lanes with a single fast-feedback default', function (): void {
$manifest = TestLaneManifest::manifest();
$laneIds = array_column($manifest['lanes'], 'id');
$defaultLanes = array_values(array_filter(
$manifest['lanes'],
static fn (array $lane): bool => $lane['defaultEntryPoint'] === true,
));
expect($manifest['version'])->toBe(1)
->and($manifest['artifactDirectory'])->toBe('storage/logs/test-lanes')
->and($laneIds)->toEqualCanonicalizing([
'fast-feedback',
'confidence',
'browser',
'heavy-governance',
'profiling',
'junit',
])
->and($defaultLanes)->toHaveCount(1)
->and($defaultLanes[0]['id'])->toBe('fast-feedback');
});
it('keeps every lane declaration populated with governance metadata, selectors, and budgets', function (): void {
foreach (TestLaneManifest::manifest()['lanes'] as $lane) {
expect(trim($lane['description']))->not->toBe('')
->and(trim($lane['intendedAudience']))->not->toBe('')
->and($lane['includedFamilies'])->not->toBeEmpty()
->and($lane['ownershipExpectations'])->not->toBe('')
->and($lane['artifacts'])->not->toBeEmpty()
->and($lane['budget']['thresholdSeconds'])->toBeGreaterThan(0)
->and($lane['budget']['baselineSource'])->toBeString()
->and($lane['dbStrategy']['connectionMode'])->toBeString();
$selectors = $lane['selectors'];
foreach ([
'includeSuites',
'includePaths',
'includeGroups',
'includeFiles',
'excludeSuites',
'excludePaths',
'excludeGroups',
'excludeFiles',
] as $selectorKey) {
expect($selectors)->toHaveKey($selectorKey);
}
}
});
it('seeds at least one initial heavy family budget beside the lane-level budgets', function (): void {
$familyBudgets = TestLaneManifest::familyBudgets();
expect($familyBudgets)->not->toBeEmpty()
->and($familyBudgets[0]['familyId'])->toBeString()
->and($familyBudgets[0]['selectors'])->not->toBeEmpty()
->and($familyBudgets[0]['thresholdSeconds'])->toBeGreaterThan(0);
});