46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Auth;
|
|
|
|
use App\Models\User;
|
|
use Livewire\Volt\Volt;
|
|
|
|
test('confirm password screen can be rendered', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get('/confirm-password');
|
|
|
|
$response
|
|
->assertSeeVolt('pages.auth.confirm-password')
|
|
->assertStatus(200);
|
|
});
|
|
|
|
test('password can be confirmed', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$component = Volt::test('pages.auth.confirm-password')
|
|
->set('password', 'password');
|
|
|
|
$component->call('confirmPassword');
|
|
|
|
$component
|
|
->assertRedirect('/dashboard')
|
|
->assertHasNoErrors();
|
|
});
|
|
|
|
test('password is not confirmed with invalid password', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user);
|
|
|
|
$component = Volt::test('pages.auth.confirm-password')
|
|
->set('password', 'wrong-password');
|
|
|
|
$component->call('confirmPassword');
|
|
|
|
$component
|
|
->assertNoRedirect()
|
|
->assertHasErrors('password');
|
|
});
|