libra/tests/Feature/DashboardTest.php

30 lines
866 B
PHP

<?php
use App\Models\User;
test('guests are redirected to the login page for admin dashboard', function () {
$response = $this->get('/admin/dashboard');
$response->assertRedirect(route('login'));
});
test('guests are redirected to the login page for client dashboard', function () {
$response = $this->get('/client/dashboard');
$response->assertRedirect(route('login'));
});
test('authenticated admin can visit admin dashboard', function () {
$user = User::factory()->admin()->create();
$this->actingAs($user);
$response = $this->get('/admin/dashboard');
$response->assertStatus(200);
});
test('authenticated client can visit client dashboard', function () {
$user = User::factory()->individual()->create();
$this->actingAs($user);
$response = $this->get('/client/dashboard');
$response->assertStatus(200);
});