feat: add routes, lang, tests, stubs, docs, and docker configurations
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
test('health endpoint returns 200 when no check fails', function () {
|
||||
$response = $this->getJson('/api/health');
|
||||
|
||||
$response->assertOk()
|
||||
->assertJsonStructure(['status', 'timestamp', 'checks' => ['database', 'storage', 'queue']]);
|
||||
|
||||
expect($response->json('status'))->toBeIn(['healthy', 'warn']);
|
||||
});
|
||||
|
||||
test('health endpoint returns JSON with timestamp', function () {
|
||||
$response = $this->getJson('/api/health');
|
||||
|
||||
$response->assertOk()->assertJsonStructure(['timestamp']);
|
||||
|
||||
expect($response->json('timestamp'))->toBeString();
|
||||
});
|
||||
|
||||
test('health endpoint reports per-check status keys', function () {
|
||||
$checks = $this->getJson('/api/health')->json('checks');
|
||||
|
||||
foreach (['database', 'redis', 'storage', 'queue'] as $key) {
|
||||
expect($checks)->toHaveKey($key);
|
||||
expect($checks[$key]['status'])->toBeIn(['ok', 'warn', 'fail', 'unknown']);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user