fedi-feed-router/tests/Unit/Services/SystemStatusServiceTest.php

44 lines
No EOL
1.3 KiB
PHP

<?php
namespace Tests\Unit\Services;
use App\Services\SystemStatusService;
use Tests\TestCase;
use Illuminate\Support\Facades\Http;
class SystemStatusServiceTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
// Mock HTTP requests to prevent external calls
Http::fake([
'*' => Http::response('', 500)
]);
}
public function test_service_instantiation(): void
{
$service = new SystemStatusService();
$this->assertInstanceOf(SystemStatusService::class, $service);
}
public function test_get_system_status_returns_correct_structure(): void
{
$service = new SystemStatusService();
$status = $service->getSystemStatus();
$this->assertIsArray($status);
$this->assertArrayHasKey('is_enabled', $status);
$this->assertArrayHasKey('status', $status);
$this->assertArrayHasKey('status_class', $status);
$this->assertArrayHasKey('reasons', $status);
// Without database setup, system should be disabled
$this->assertFalse($status['is_enabled']);
$this->assertEquals('Disabled', $status['status']);
$this->assertEquals('text-red-600', $status['status_class']);
$this->assertIsArray($status['reasons']);
}
}