mengw15 opened a new pull request, #6511:
URL: https://github.com/apache/texera/pull/6511
### What changes were proposed in this PR?
Adds a Vitest spec for `AgentInteractionComponent`
(`frontend/src/app/workspace/component/agent/agent-interaction/`), which had
no
spec (codecov ~23%). Follows `frontend/TESTING.md` (TestBed +
`detectChanges()`)
and mirrors the sibling `agent-chat.component.spec.ts` mocking conventions.
25 behavior-focused tests:
- **create / input binding** — renders the template; the `operatorId`,
`operatorDisplayName`, `sampleRecords`, and `resultStatistics` inputs bind.
- **`loadAvailableAgents` (ngOnInit)** — maps agents and flags
actively-connected
ones; auto-selects the connected agent, or the sole agent when none is
connected, and leaves the selection empty with multiple disconnected
agents;
reloads when `agentChange$` emits.
- **`isSelectedAgentConnected` / `canSend`** — the connection check and the
send-enabled guard over `selectedAgentId` + `feedbackMessage`.
- **`sendFeedbackToAgent`** — no-ops on missing agent / blank message /
missing
operatorId; errors when the agent is not connected; on success sends the
operator-context message with source `"feedback"`, notifies, and clears the
input; resolves the operator name from `operatorDisplayName`, then the
graph's
custom display name, then the `"this operator"` fallback.
- **sample-record helpers** — visualization detection, column ordering
(row-index
first, displayed as "Row"), and ellipsis rows on row-index gaps.
- **column statistics** — parses `resultStatistics` JSON and excludes noisy
keys.
- **`ngOnChanges`** — sanitizes and caches the visualization html, and
clears the
cache when new records carry no html-content.
No production code was changed.
### Any related issues, documentation, discussions?
Closes #6506
### How was this PR tested?
New Vitest spec, run locally in `frontend/` (all green; failure path
verified by
deliberately breaking an assertion to confirm the suite goes red):
```
ng test --watch=false --include
src/app/workspace/component/agent/agent-interaction/agent-interaction.component.spec.ts
# Test Files 1 passed (1) / Tests 25 passed (25)
eslint <spec> # clean
prettier --check # clean
```
`AgentService`, `WorkflowActionService`, and `NotificationService` are
mocked; the
real `DomSanitizer` is used. The spec makes no network calls and touches no
live
services.
### 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]