You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add unit tests for ReActStepDetailModalComponent #5468
ReActStepDetailModalComponent (frontend/src/app/workspace/component/agent/agent-panel/react-step-detail-modal/react-step-detail-modal.component.ts) has no *.spec.ts file. Despite its length, it has no injected services. It is mostly pure formatting/parsing helpers over plain objects, which makes it very testable without mocks. It exposes @Inputs (visible, step, agentId) and an @Output (visibleChange).
What to do (step by step)
Create the spec next to the component, with the Apache license header.
No providers are needed beyond importing the standalone component.
Drive the pure helpers with small hand-built objects and assert the returned strings.
Run yarn test -- react-step-detail-modal, then yarn lint.
Cover (pick the pure helpers first, they are the easy wins)
should create.
closeModal() sets visible = false and emits false on visibleChange (use vi.spyOn(component.visibleChange, "emit")).
formatResult(data) and formatJson(data): pass an object, assert pretty-printed JSON; pass a string, assert it is returned as-is where applicable.
getMessageRoleColor(role): assert the color returned for a couple of known roles and the default.
getTextFromMessage(msg), getToolCallStrings(msg), getToolCallSummaries(msg), getToolResultItems(msg): feed representative message objects and assert the extracted fields. Look at the ReActStep type for shape hints.
hasOperatorAccess(step): true/false branches.
Tips
These helpers are deterministic; build the smallest input object that exercises each branch and assert the exact output.
You do not need fixture.detectChanges() for the pure-helper tests; call methods on the component instance directly.
Activity
Ma77Ball commentedon Jun 7, 2026
reserved for beginner task
yangzhang75 commentedon Jun 10, 2026
/take
test(frontend): add unit tests for ReActStepDetailModalComponent (apa…
test(frontend): add unit tests for ReActStepDetailModalComponent (apa…