CAPS04-FE-REFACTOR / tests /Feature /Auth /RegistrationTest.php
wepee's picture
add: page /mahasiswa
32177e2
Raw
History Blame Contribute Delete
1.19 kB
<?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));
});