<?php

namespace Tests\Unit\Services\Frontend;

use App\Models\User;
use App\Services\Frontend\ProfileIconService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class ProfileIconServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_build_for_user_returns_initials(): void
    {
        $user = User::query()->create([
            'firstname' => 'Jane',
            'lastname' => 'Smith',
            'email' => 'jane@example.com',
            'cellphone' => '5555555555',
            'address_street' => '123 Main',
            'city' => 'City',
            'state' => 'ST',
            'zip' => '12345',
            'accept_school_policy' => 1,
            'status' => 'Active',
            'password' => bcrypt('secret'),
            'semester' => 'Fall',
            'school_year' => '2025-2026',
        ]);

        $service = app(ProfileIconService::class);
        $payload = $service->buildForUser($user->id);

        $this->assertSame('JS', $payload['userInitials']);
    }
}
