actingAs($user); Filament::setTenant($tenant, true); $scopeKey = hash('sha256', 'scope-landing-comparison-info'); $baseline = createInventorySyncOperationRun($tenant, [ 'selection_hash' => $scopeKey, 'status' => 'success', 'finished_at' => now()->subDays(2), ]); $current = createInventorySyncOperationRun($tenant, [ 'selection_hash' => $scopeKey, 'status' => 'success', 'finished_at' => now()->subDay(), ]); Livewire::test(DriftLanding::class) ->assertSet('scopeKey', $scopeKey) ->assertSet('baselineRunId', (int) $baseline->getKey()) ->assertSet('currentRunId', (int) $current->getKey()) ->assertSet('baselineFinishedAt', $baseline->finished_at->toDateTimeString()) ->assertSet('currentFinishedAt', $current->finished_at->toDateTimeString()); }); test('drift landing exposes baseline compare coverage + fidelity context when available', function () { [$user, $tenant] = createUserWithTenant(role: 'manager'); $this->actingAs($user); Filament::setTenant($tenant, true); $scopeKey = hash('sha256', 'scope-landing-comparison-info'); createInventorySyncOperationRun($tenant, [ 'selection_hash' => $scopeKey, 'status' => 'success', 'finished_at' => now()->subDays(2), ]); createInventorySyncOperationRun($tenant, [ 'selection_hash' => $scopeKey, 'status' => 'success', 'finished_at' => now()->subDay(), ]); $profile = BaselineProfile::factory()->active()->create([ 'workspace_id' => (int) $tenant->workspace_id, ]); $snapshot = BaselineSnapshot::factory()->create([ 'workspace_id' => (int) $tenant->workspace_id, 'baseline_profile_id' => (int) $profile->getKey(), ]); $profile->update(['active_snapshot_id' => (int) $snapshot->getKey()]); BaselineTenantAssignment::factory()->create([ 'workspace_id' => (int) $tenant->workspace_id, 'tenant_id' => (int) $tenant->getKey(), 'baseline_profile_id' => (int) $profile->getKey(), ]); $compareRun = OperationRun::factory()->create([ 'tenant_id' => (int) $tenant->getKey(), 'workspace_id' => (int) $tenant->workspace_id, 'type' => OperationRunType::BaselineCompare->value, 'status' => OperationRunStatus::Completed->value, 'outcome' => OperationRunOutcome::PartiallySucceeded->value, 'completed_at' => now()->subMinutes(5), 'context' => [ 'baseline_profile_id' => (int) $profile->getKey(), 'baseline_snapshot_id' => (int) $snapshot->getKey(), 'baseline_compare' => [ 'coverage' => [ 'effective_types' => ['deviceConfiguration'], 'covered_types' => [], 'uncovered_types' => ['deviceConfiguration'], 'proof' => false, ], 'fidelity' => 'meta', ], ], ]); Livewire::test(DriftLanding::class) ->assertSet('baselineCompareRunId', (int) $compareRun->getKey()) ->assertSet('baselineCompareCoverageStatus', 'unproven') ->assertSet('baselineCompareFidelity', 'meta') ->assertSet('baselineCompareUncoveredTypesCount', 1); });