mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 15:39:59 +00:00
Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: rosslh <ross@rosshill.ca>
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Models\InstanceSettings;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\Once;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
InstanceSettings::forceCreate(['id' => 0]);
|
|
Once::flush();
|
|
});
|
|
|
|
it('registers the fortify passkey routes', function () {
|
|
expect(Route::has('passkey.login-options'))->toBeTrue()
|
|
->and(Route::has('passkey.login'))->toBeTrue()
|
|
->and(Route::has('passkey.confirm'))->toBeTrue()
|
|
->and(Route::has('passkey.store'))->toBeTrue();
|
|
});
|
|
|
|
it('returns a stable 64 character hex user handle', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$handle = $user->getPasskeyUserHandle();
|
|
|
|
expect($handle)->toMatch('/^[0-9a-f]{64}$/')
|
|
->and(User::find($user->id)->getPasskeyUserHandle())->toBe($handle);
|
|
});
|
|
|
|
it('enables passkeys by default and stores passkeys for a user', function () {
|
|
$user = User::factory()->create();
|
|
$user->passkeys()->create([
|
|
'name' => 'Laptop',
|
|
'credential_id' => 'credential-1',
|
|
'credential' => ['aaguid' => '00000000-0000-0000-0000-000000000000'],
|
|
]);
|
|
|
|
expect(instanceSettings()->is_passkey_enabled)->toBeTrue()
|
|
->and($user->hasPasskeysEnabled())->toBeTrue();
|
|
});
|