<?php

declare(strict_types=1);

namespace App\Tests\Unit\Auth;

use App\Domain\Auth\TokenHasher;
use PHPUnit\Framework\TestCase;

final class TokenHasherTest extends TestCase
{
    public function testProducesSha256HexDigest(): void
    {
        $hasher = new TokenHasher();
        $raw = 'irdb_adm_ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
        $expected = hash('sha256', $raw);

        self::assertSame($expected, $hasher->hash($raw));
        self::assertSame(64, strlen($hasher->hash($raw)));
    }

    public function testIsDeterministic(): void
    {
        $hasher = new TokenHasher();
        $raw = 'irdb_svc_ZYXWVUTSRQPONMLKJIHGFEDCBA765432';

        self::assertSame($hasher->hash($raw), $hasher->hash($raw));
    }
}
