Skip to content

Commit d1a9b23

Browse files
committed
Fix Test
1 parent 94f117f commit d1a9b23

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

config/fortify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
// Features::updateProfileInformation(),
151151
// Features::updatePasswords(),
152152
Features::twoFactorAuthentication([
153-
'confirm' => true,
153+
'confirm' => false,
154154
'confirmPassword' => true,
155155
// 'window' => 0
156156
]),

resources/js/pages/auth/two-factor-challenge.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,13 @@ import { Form, Head } from '@inertiajs/react';
88
import { REGEXP_ONLY_DIGITS } from 'input-otp';
99
import { useMemo, useState } from 'react';
1010

11-
interface AuthConfigContent {
12-
title: string;
13-
description: string;
14-
toggleText: string;
15-
}
11+
const OTP_MAX_LENGTH = 6;
1612

1713
export default function TwoFactorChallenge() {
18-
const OTP_MAX_LENGTH = 6;
1914
const [showRecoveryInput, setShowRecoveryInput] = useState<boolean>(false);
2015
const [code, setCode] = useState<string>('');
2116

22-
const authConfigContent = useMemo<AuthConfigContent>(() => {
17+
const authConfigContent = useMemo<{ title: string; description: string; toggleText: string }>(() => {
2318
if (showRecoveryInput) {
2419
return {
2520
title: 'Recovery Code',

tests/Feature/Auth/PasswordConfirmationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ public function test_confirm_password_screen_can_be_rendered()
1919

2020
$response->assertStatus(200);
2121
$response->assertInertia(fn (Assert $page) => $page
22-
->component('auth/confirm-password')
22+
->component('auth/ConfirmPassword')
2323
);
2424
}
2525

2626
public function test_password_confirmation_requires_authentication()
2727
{
2828
$response = $this->get(route('password.confirm'));
29+
2930
$response->assertRedirect(route('login'));
3031
}
3132
}

tests/Feature/Auth/PasswordResetTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ public function test_reset_password_screen_can_be_rendered()
3838

3939
$this->post(route('password.email'), ['email' => $user->email]);
4040

41-
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
42-
$response = $this->get(route('password.reset', $notification->token));
43-
44-
$response->assertStatus(200);
41+
Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) {
42+
$response = $this->get(route('password.reset', $notification->token).'?email='.$user->email);
43+
44+
$response->assertStatus(200)
45+
->assertInertia(fn ($page) => $page
46+
->component('auth/reset-password')
47+
->has('email')
48+
->has('token')
49+
->where('email', $user->email)
50+
->where('token', $notification->token)
51+
);
4552

4653
return true;
4754
});

tests/Feature/Settings/TwoFactorAuthenticationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public function test_controller_removes_confirming_session_data_when_cleanup_tri
166166
]);
167167

168168
$user = User::factory()->create();
169+
169170
$user->forceFill([
170171
'two_factor_secret' => encrypt('test-secret'),
171172
'two_factor_recovery_codes' => encrypt(json_encode(['code1', 'code2'])),
@@ -190,6 +191,7 @@ public function test_two_factor_authentication_disabled_when_confirmation_abando
190191
]);
191192

192193
$user = User::factory()->create();
194+
193195
$user->forceFill([
194196
'two_factor_secret' => encrypt('test-secret'),
195197
'two_factor_recovery_codes' => encrypt(json_encode(['code1', 'code2'])),

0 commit comments

Comments
 (0)