Spaces:
Sleeping
Sleeping
File size: 1,187 Bytes
ec474ac 32177e2 ec474ac 32177e2 ec474ac 32177e2 ec474ac 32177e2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | <?php
use Inertia\Testing\AssertableInertia as Assert;
use Laravel\Fortify\Features;
beforeEach(function () {
$this->skipUnlessFortifyHas(Features::registration());
});
test('registration screen can be rendered', function () {
$response = $this->get(route('register'));
$response->assertOk();
$response->assertInertia(fn (Assert $page) => $page
->component('auth/register-choice'),
);
});
test('role registration screens can be rendered', function (string $routeName, string $component) {
$this->get(route($routeName))
->assertOk()
->assertInertia(fn (Assert $page) => $page
->component($component),
);
})->with([
'mahasiswa' => ['register.mahasiswa', 'auth/register-mahasiswa'],
'dosen' => ['register.dosen', 'auth/register-dosen'],
]);
test('new users can register', function () {
$response = $this->post(route('register.store'), [
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(route('dashboard', absolute: false));
});
|