forge/tests/Feature/User/PasswordConfirmationTest.php

36 lines
954 B
PHP
Raw Normal View History

2024-07-18 00:11:32 -04:00
<?php
use App\Models\User;
use Laravel\Jetstream\Features;
test('confirm password screen can be rendered', function () {
$user = Features::hasTeamFeatures()
? User::factory()->withPersonalTeam()->create()
: User::factory()->create();
$response = $this->actingAs($user)->get('/user/confirm-password');
$response->assertStatus(200);
});
test('password can be confirmed', function () {
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/user/confirm-password', [
'password' => 'password',
]);
$response->assertRedirect();
$response->assertSessionHasNoErrors();
});
test('password is not confirmed with invalid password', function () {
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/user/confirm-password', [
'password' => 'wrong-password',
]);
$response->assertSessionHasErrors();
});