mengw15 opened a new pull request, #6520: URL: https://github.com/apache/texera/pull/6520
### What changes were proposed in this PR? Adds a behavior-focused Vitest spec for `AgentRegistrationComponent` (`frontend/src/app/workspace/component/agent/agent-panel/agent-registration/agent-registration.component.ts`), previously without a spec (~11.5% coverage). `AgentService`, `NotificationService`, `WorkflowActionService`, and `ComputingUnitStatusService` are stubbed; the component renders with `detectChanges()`. 13 tests cover: - `should create`, template renders, and `customAgentName` defaults to `"Texera Agent"`. - `ngOnInit` — loads the fetched model types and clears `isLoadingModels`; flags `hasLoadingError` + notifies when no models are returned; flags the error + notifies when the fetch fails; and sets `computingUnitConnected` only when the status is `Running`. - `selectModelType` updates `selectedModelType`. - `createAgent` — emits `agentCreated` with the new id and resets the form on success; forwards the model, name (or `undefined` when blank), and workflow id to the service; is a no-op when no model is selected or a creation is already in progress; and notifies + clears `isCreating` on failure. - `canCreate` requires a selected model, an idle form, and a connected computing unit. No production code was changed. ### Any related issues, documentation, discussions? Closes #6514 ### How was this PR tested? New unit tests, run locally in `frontend/` (all green; the failure path was verified by deliberately breaking the `agentCreated` emit assertion to confirm the suite goes red): ``` ng test --watch=false --include src/app/workspace/component/agent/agent-panel/agent-registration/agent-registration.component.spec.ts # Test Files 1 passed (1) | Tests 13 passed (13) prettier --write <spec> # formatted eslint <spec> # clean ``` All four services are stubbed, so the suite makes no network calls (see `frontend/TESTING.md`). ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.8 [1M context]) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
