41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Livewire\Auth\ConfirmPassword;
|
|
use App\Models\User;
|
|
use Livewire\Livewire;
|
|
|
|
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
|
|
|
|
test('confirm password screen can be rendered', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get('/confirm-password');
|
|
|
|
$response->assertStatus(200);
|
|
});
|
|
|
|
test('password can be confirmed', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$response = Livewire::test(ConfirmPassword::class)
|
|
->set('password', 'password')
|
|
->call('confirmPassword');
|
|
|
|
$response
|
|
->assertHasNoErrors()
|
|
->assertRedirect(route('dashboard', absolute: false));
|
|
});
|
|
|
|
test('password is not confirmed with invalid password', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$response = Livewire::test(ConfirmPassword::class)
|
|
->set('password', 'wrong-password')
|
|
->call('confirmPassword');
|
|
|
|
$response->assertHasErrors(['password']);
|
|
}); |