Skip to content

Add unit tests for ReActStepDetailModalComponent #5468

Closed

Description

@Ma77Ball

Task Summary

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)

  1. Create the spec next to the component, with the Apache license header.
  2. No providers are needed beyond importing the standalone component.
  3. Drive the pure helpers with small hand-built objects and assert the returned strings.
  4. 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.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Activity

  1. added theissue type on Jun 7, 2026
  2. Ma77Ball commented on Jun 7, 2026

    @Ma77Ball
    ContributorAuthor

    reserved for beginner task

  3. yangzhang75 commented on Jun 10, 2026

    @yangzhang75
    Contributor

    /take

  4. added a commit that references this issue on Jun 13, 2026
    58e5b43
  5. added a commit that references this issue on Jun 22, 2026
    394375a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions