Skip to content

Commit 55ddca7

Browse files
committed
Migrate ForgotPassword feature tests
1 parent 2f8859b commit 55ddca7

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tests/Feature/Auth/ForgotPasswordTest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22

33
declare(strict_types=1);
44

5-
use App\Livewire\Auth\ForgotPassword;
65
use App\Models\User;
7-
use Livewire\Livewire;
86

97
it('returns a successful response', function (): void {
10-
Livewire::test(ForgotPassword::class)
11-
->assertStatus(200);
8+
$response = $this->get(route('forgot.password'));
9+
10+
$response->assertStatus(200);
1211
});
1312

1413
it('sends a password reset link', function (): void {
1514
$user = User::factory()->create();
1615

17-
Livewire::test(ForgotPassword::class)
18-
->set('form.email', $user->email)
19-
->call('send')
20-
->assertSee('We have emailed your password reset link');
16+
$response = $this->post(route('forgot.password'), [
17+
'email' => $user->email,
18+
]);
19+
20+
$response->assertSessionHas('status', 'We have emailed your password reset link.');
2121
});
2222

2323
it('fails sending a password reset link', function (): void {
24-
Livewire::test(ForgotPassword::class)
25-
->set('form.email', '[email protected]')
26-
->call('send')
27-
->assertSee('We can\'t find a user with that email address');
24+
$response = $this->post(route('forgot.password'), [
25+
'email' => fake()->email(),
26+
]);
27+
28+
$response->assertSessionHasErrors([
29+
'email' => 'We can\'t find a user with that email address.',
30+
]);
2831
});

0 commit comments

Comments
 (0)