Files
api/services/nginx/app/tests/Unit/Workfeed/DepartmentWeatherTimelineSchemaConformanceTest.php
T

37 lines
1.2 KiB
PHP

<?php
it('includes a date key in department weather timeline entries', function (): void {
$routeFile = app_path('routes/moduleWeatherAPIRoute.php');
$content = (string)file_get_contents($routeFile);
expect($content)->toContain("'date' => \$slot->format('Y-m-d')");
expect($content)->toContain("'current' => \$slot_key === \$current_slot_key");
});
it('documents the date key in the openapi department weather timeline schema', function (): void {
$candidates = [
WD . '/openapi.yaml',
dirname(WD) . '/openapi.yaml',
dirname(WD, 2) . '/openapi.yaml',
];
$openApiFile = null;
foreach ($candidates as $candidate) {
if (is_file($candidate)) {
$openApiFile = $candidate;
break;
}
}
if ($openApiFile === null) {
$this->markTestSkipped('openapi.yaml is not mounted in this test container.');
}
$content = (string)file_get_contents($openApiFile);
expect($content)->toContain('DepartmentWeatherTimelineEntry:');
expect($content)->toContain('format: date');
expect($content)->toContain('type: boolean');
expect($content)->toContain('required: [date, time, current, weather, washes, hours, status]');
});