wowowowowo
This commit is contained in:
53
tests/Feature/NavigationUiTest.php
Normal file
53
tests/Feature/NavigationUiTest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Application;
|
||||
use App\Models\Environment;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
use Inertia\Testing\AssertableInertia;
|
||||
|
||||
it('shares environment first navigation context with onboarding counts', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
$user->organisations()->attach($organisation, ['role' => 'admin']);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('organisations.show', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->where('organisation.id', $organisation->id)
|
||||
->where('organisation.providers_count', 0)
|
||||
->where('organisation.applications_count', 0));
|
||||
});
|
||||
|
||||
it('lists environments across applications', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
$application = Application::factory()->for($organisation)->create();
|
||||
Environment::factory()->for($application)->create(['name' => 'production']);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('environments.index', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('environments/Index', false)
|
||||
->has('applications.0.environments', 1));
|
||||
});
|
||||
|
||||
it('shows the server provider create page', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('providers.create', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('providers/Create', false)
|
||||
->has('providerTypes'));
|
||||
});
|
||||
Reference in New Issue
Block a user