|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use App\Livewire\Auth\ForgotPassword; |
6 | 5 | use App\Models\User; |
7 | | -use Livewire\Livewire; |
8 | 6 |
|
9 | 7 | 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); |
12 | 11 | }); |
13 | 12 |
|
14 | 13 | it('sends a password reset link', function (): void { |
15 | 14 | $user = User::factory()->create(); |
16 | 15 |
|
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.'); |
21 | 21 | }); |
22 | 22 |
|
23 | 23 | 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 | + ]); |
28 | 31 | }); |
0 commit comments