52 lines
1.8 KiB
PHP
52 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\Monitoring\Operations;
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Models\OperationRun;
|
|
use App\Support\OperationRunLinks;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Livewire\Livewire;
|
|
|
|
it('Spec338 OperationRunLinks operation type deep links use operation_type and never tableFilters', function (): void {
|
|
[$workspace] = localizationWorkspaceMember();
|
|
|
|
$url = OperationRunLinks::index(operationType: 'inventory_sync', workspace: $workspace);
|
|
|
|
expect($url)
|
|
->toContain('/admin/workspaces/'.$workspace->getRouteKey().'/operations')
|
|
->toContain('operation_type=inventory.sync')
|
|
->not->toContain('tableFilters')
|
|
->not->toContain('inventory_sync');
|
|
});
|
|
|
|
it('Spec338 operations hub maps operation_type query into the type table filter', function (): void {
|
|
$environment = ManagedEnvironment::factory()->active()->create([
|
|
'name' => 'Spec338 Environment A',
|
|
'external_id' => 'spec338-environment-a',
|
|
]);
|
|
[$user, $environment] = createUserWithTenant(tenant: $environment, role: 'owner', workspaceRole: 'owner');
|
|
$workspace = $environment->workspace()->firstOrFail();
|
|
|
|
$runInventory = OperationRun::factory()
|
|
->forTenant($environment)
|
|
->create(['type' => 'inventory_sync']);
|
|
|
|
$runPolicy = OperationRun::factory()
|
|
->forTenant($environment)
|
|
->create(['type' => 'policy.sync']);
|
|
|
|
$this->actingAs($user);
|
|
setAdminPanelContext();
|
|
session()->put(WorkspaceContext::SESSION_KEY, (int) $workspace->getKey());
|
|
|
|
Livewire::withQueryParams(['operation_type' => 'inventory.sync'])
|
|
->actingAs($user)
|
|
->test(Operations::class)
|
|
->assertSet('tableFilters.type.value', 'inventory.sync')
|
|
->assertCanSeeTableRecords([$runInventory])
|
|
->assertCanNotSeeTableRecords([$runPolicy]);
|
|
});
|
|
|