<?php

namespace Tests\Unit\Resources\Roles;

use App\Http\Resources\Roles\UserWithRolesResource;
use Tests\TestCase;

class UserWithRolesResourceTest extends TestCase
{
    public function test_resource_shape(): void
    {
        $resource = new UserWithRolesResource([
            'id' => 1,
            'firstname' => 'Admin',
            'lastname' => 'User',
            'email' => 'admin@example.com',
            'account_id' => 'A1',
            'roles' => 'admin,teacher',
        ]);

        $payload = $resource->toArray(request());

        $this->assertArrayHasKey('roles', $payload);
        $this->assertCount(2, $payload['roles']);
    }
}
