Files
api/services/nginx/app/tests/Unit/Search/SystemSearchOpenApiSpecTest.php
T

39 lines
1.3 KiB
PHP

<?php
function system_search_openapi_content_or_skip(): string
{
$candidates = [
dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . 'openapi.yaml',
dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'openapi.yaml',
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'openapi.yaml',
];
foreach ($candidates as $candidate) {
if (is_file($candidate)) {
$content = file_get_contents($candidate);
if ($content !== false) {
return $content;
}
}
}
test()->markTestSkipped('openapi.yaml is not available in this runtime environment.');
}
it('documents system-wide search endpoints in openapi', function (): void {
$content = system_search_openapi_content_or_skip();
expect($content)->toContain('/search/system:');
expect($content)->toContain('/superuser/search/system/cache:');
expect($content)->toContain('/superuser/search/system/cache/rebuild:');
});
it('documents debug_intent and parser metadata schema in openapi', function (): void {
$content = system_search_openapi_content_or_skip();
expect($content)->toContain('debug_intent:');
expect($content)->toContain('SystemSearchIntentParserMeta:');
expect($content)->toContain('intent_parser:');
expect($content)->toContain('SystemSearchResponse:');
});