<?php

use App\Rules\VerificationRule;

it('normalizes the bypass phone number from international format', function () {
    expect(normalizeTurkmenPhoneNumber('+99365222548'))->toBe('65222548');
});

it('allows the approved otp bypass code for the approved phone number', function () {
    $failed = false;

    (new VerificationRule('+99365222548'))->validate('code', 12212, function () use (&$failed) {
        $failed = true;
    });

    expect($failed)->toBeFalse();
});

it('does not allow the otp bypass code for other phone numbers', function () {
    expect(isOtpBypass('+99365222549', 12212))->toBeFalse();
});
