build: initialize RetroHub with Laravel, Inertia, Vue, and Horizon
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Features\Consoles\Models\Console;
|
||||
use App\Features\Games\Models\Game;
|
||||
use App\Features\Games\Models\RomFile;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DashboardTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_dashboard_requires_authentication(): void
|
||||
{
|
||||
$this->get(route('dashboard'))->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
public function test_dashboard_can_be_rendered(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('dashboard'))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_dashboard_shows_stats_with_data(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$console = Console::factory()->create();
|
||||
$game = Game::factory()->create(['console_id' => $console->id]);
|
||||
RomFile::factory()->create(['game_id' => $game->id]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('dashboard'))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_dashboard_shows_recent_games(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$console = Console::factory()->create();
|
||||
Game::factory()->count(3)->create(['console_id' => $console->id]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('dashboard'))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_dashboard_shows_consoles(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
Console::factory()->count(5)->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('dashboard'))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_dashboard_with_empty_data(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('dashboard'))
|
||||
->assertOk();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user