feat: add public entry page for KAN-50
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Tests\TestCase;
|
||||
|
||||
class WelcomeTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_public_entry_page_is_available_to_guests(): void
|
||||
{
|
||||
$this->get(route('home'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Welcome')
|
||||
->where('auth.user', null));
|
||||
}
|
||||
|
||||
public function test_public_entry_page_recognizes_authenticated_users(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('home'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Welcome')
|
||||
->where('auth.user.id', $user->id));
|
||||
}
|
||||
|
||||
public function test_public_entry_page_presentation_and_localization(): void
|
||||
{
|
||||
$process = new Process(['node', 'tests/Fixtures/welcome.mjs'], base_path());
|
||||
$process->setTimeout(60);
|
||||
$process->run();
|
||||
|
||||
$this->assertTrue($process->isSuccessful(), $process->getOutput().$process->getErrorOutput());
|
||||
$this->assertStringContainsString('Welcome behavior checks passed.', $process->getOutput());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user