Spaces:
Sleeping
Sleeping
| 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)); | |
| }); | |