<?php

namespace Tests\Unit\Services\Administrator;

use App\Services\Administrator\AdministratorDashboardService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Mockery;
use Tests\TestCase;

class AdministratorDashboardServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_delegates_to_metrics_and_search(): void
    {
        $metrics = Mockery::mock(\App\Services\Administrator\AdministratorMetricsService::class);
        $metrics->shouldReceive('metrics')->once()->andReturn(['counts' => []]);

        $search = Mockery::mock(\App\Services\Administrator\AdministratorUserSearchService::class);
        $search->shouldReceive('search')->once()->with('john')->andReturn(['results' => []]);

        $service = new AdministratorDashboardService($metrics, $search);

        $this->assertSame(['counts' => []], $service->metrics());
        $this->assertSame(['results' => []], $service->userSearch('john'));
    }
}
