active()->create([ 'workspace_id' => (int) $tenant->workspace_id, 'scope_jsonb' => ['policy_types' => ['deviceConfiguration'], 'foundation_types' => []], ]); $snapshot = BaselineSnapshot::factory()->incomplete()->create([ 'workspace_id' => (int) $tenant->workspace_id, 'baseline_profile_id' => (int) $profile->getKey(), ]); createInventorySyncOperationRunWithCoverage($tenant, ['deviceConfiguration' => 'succeeded']); $run = OperationRun::factory()->create([ 'tenant_id' => (int) $tenant->getKey(), 'workspace_id' => (int) $tenant->workspace_id, 'user_id' => (int) $user->getKey(), 'type' => OperationRunType::BaselineCompare->value, 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, 'summary_counts' => ['total' => 0], 'context' => [ 'baseline_profile_id' => (int) $profile->getKey(), 'baseline_snapshot_id' => (int) $snapshot->getKey(), 'effective_scope' => ['policy_types' => ['deviceConfiguration'], 'foundation_types' => []], ], ]); (new CompareBaselineToTenantJob($run))->handle( app(BaselineSnapshotIdentity::class), app(AuditLogger::class), app(OperationRunService::class), ); $run->refresh(); expect($run->status)->toBe(OperationRunStatus::Completed->value) ->and($run->outcome)->toBe(OperationRunOutcome::Blocked->value) ->and(data_get($run->context, 'reason_code'))->toBe(BaselineReasonCodes::COMPARE_SNAPSHOT_INCOMPLETE) ->and(data_get($run->failure_summary, '0.code'))->toBe('operation.blocked') ->and(data_get($run->failure_summary, '0.reason_code'))->toBe(BaselineReasonCodes::COMPARE_SNAPSHOT_INCOMPLETE) ->and(data_get($run->summary_counts, 'total'))->toBeInt(); });