Skip to content

Commit 4634eaf

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 76fa0f8 commit 4634eaf

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

tests/Browser/Auth/VerificationNotificationTest.php

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
use App\Models\User;
4+
use Illuminate\Support\Facades\Hash;
5+
6+
use function Pest\Laravel\actingAs;
7+
8+
test('password update page is displayed', function () {
9+
actingAs(User::factory()->create());
10+
11+
visit(route('password.edit'))
12+
->assertSee('Update password')
13+
->assertSee('Ensure your account is using a long, random password to stay secure')
14+
->assertNoConsoleLogs()
15+
->assertNoJavaScriptErrors();
16+
});
17+
18+
test('password can be updated', function () {
19+
actingAs($user = User::factory()->create());
20+
21+
visit(route('password.edit'))
22+
->fill('current_password', 'password')
23+
->fill('password', 'new-password')
24+
->fill('password_confirmation', 'new-password')
25+
->press('Save password')
26+
->assertSee('Saved')
27+
->assertUrlIs(route('password.edit'))
28+
->assertNoConsoleLogs()
29+
->assertNoJavaScriptErrors();
30+
31+
expect(Hash::check('new-password', $user->refresh()->password))->toBeTrue();
32+
});
33+
34+
test('correct password must be provided to update password', function () {
35+
actingAs($user = User::factory()->create());
36+
37+
visit(route('password.edit'))
38+
->fill('current_password', 'wrong-password')
39+
->fill('password', 'new-password')
40+
->fill('password_confirmation', 'new-password')
41+
->press('Save password')
42+
->assertSee('The password is incorrect.')
43+
->assertUrlIs(route('password.edit'))
44+
->assertNoConsoleLogs()
45+
->assertNoJavaScriptErrors();
46+
47+
expect(Hash::check('wrong-password', $user->refresh()->password))->toBeFalse();
48+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

0 commit comments

Comments
 (0)