Skip to content

test(frontend): add unit tests for ReActStepDetailModalComponent - #5612

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
yangzhang75:test/react-step-detail-modal-spec
Jun 13, 2026
Merged

Yicong-Huang merged 1 commit into
apache:mainfrom
yangzhang75:test/react-step-detail-modal-spec

Conversation

@yangzhang75

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Adds unit tests for ReActStepDetailModalComponent, which previously had no spec. Covers the pure display helpers: closeModal, formatResult/formatJson, getToolResult, operator-access lookups, message role colors, getTextFromMessage, getToolCallSummaries, function-call formatting (incl. long-value truncation), and getToolResultFullItems/getToolResultItems (tool-name resolution, token count, trimmed flag).

Any related issues, documentation, discussions?

Closes #5468

How was this PR tested?

New spec run via ng test (Vitest): 22 tests pass. eslint and prettier checks clean.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jun 10, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.53%. Comparing base (17607c5) to head (64ad06d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5612      +/-   ##
============================================
+ Coverage     52.40%   52.53%   +0.12%     
  Complexity     2481     2481              
============================================
  Files          1070     1070              
  Lines         41360    41360              
  Branches       4441     4441              
============================================
+ Hits          21676    21728      +52     
+ Misses        18412    18352      -60     
- Partials       1272     1280       +8     
Flag Coverage Δ *Carryforward flag
access-control-service 64.61% <ø> (ø) Carriedforward from 17607c5
agent-service 33.76% <ø> (ø) Carriedforward from 17607c5
amber 53.28% <ø> (ø) Carriedforward from 17607c5
computing-unit-managing-service 1.65% <ø> (ø) Carriedforward from 17607c5
config-service 56.71% <ø> (ø) Carriedforward from 17607c5
file-service 38.21% <ø> (ø) Carriedforward from 17607c5
frontend 47.31% <ø> (+0.30%) ⬆️
pyamber 90.72% <ø> (ø) Carriedforward from 17607c5
python 90.75% <ø> (ø) Carriedforward from 17607c5
workflow-compiling-service 58.69% <ø> (ø) Carriedforward from 17607c5

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new unit test specification for ReActStepDetailModalComponent in the frontend workspace agent panel, covering its pure formatting/parsing helper methods and simple state/output behavior.

Changes:

  • Added a new react-step-detail-modal.component.spec.ts with direct-instantiation tests (no TestBed) for the component’s pure helper methods.
  • Added coverage for modal visibility toggling, formatting utilities, tool-call/result parsing, operator-access helpers, and message role/text extraction logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xuang7 xuang7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Yicong-Huang
Yicong-Huang added this pull request to the merge queue Jun 13, 2026
Merged via the queue into apache:main with commit 58e5b43 Jun 13, 2026
18 checks passed
yangzhang75 added a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…che#5612)

<!--
Thanks for sending a pull request (PR)! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
[Contributing to
Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md)
  2. Ensure you have added or run the appropriate tests for your PR
  3. If the PR is work in progress, mark it a draft on GitHub.
  4. Please write your PR title to summarize what this PR proposes, we 
    are following Conventional Commits style for PR titles as well.
  5. Be sure to keep the PR description updated to reflect all changes.
-->

### What changes were proposed in this PR?
<!--
Please clarify what changes you are proposing. The purpose of this
section
is to outline the changes. Here are some tips for you:
  1. If you propose a new API, clarify the use case for a new API.
  2. If you fix a bug, you can clarify why it is a bug.
  3. If it is a refactoring, clarify what has been changed.
  3. It would be helpful to include a before-and-after comparison using 
     screenshots or GIFs.
  4. Please consider writing useful notes for better and faster reviews.
-->
Adds unit tests for ReActStepDetailModalComponent, which previously had
no spec. Covers the pure display helpers: closeModal,
formatResult/formatJson, getToolResult, operator-access lookups, message
role colors, getTextFromMessage, getToolCallSummaries, function-call
formatting (incl. long-value truncation), and
getToolResultFullItems/getToolResultItems (tool-name resolution, token
count, trimmed flag).

### Any related issues, documentation, discussions?
<!--
Please use this section to link other resources if not mentioned
already.
1. If this PR fixes an issue, please include `Fixes apache#1234`, `Resolves
apache#1234`
or `Closes apache#1234`. If it is only related, simply mention the issue
number.
  2. If there is design documentation, please add the link.
  3. If there is a discussion in the mailing list, please add the link.
-->
Closes apache#5468

### How was this PR tested?
<!--
If tests were added, say they were added here. Or simply mention that if
the PR
is tested with existing test cases. Make sure to include/update test
cases that
check the changes thoroughly including negative and positive cases if
possible.
If it was tested in a way different from regular unit tests, please
clarify how
you tested step by step, ideally copy and paste-able, so that other
reviewers can
test and check, and descendants can verify in the future. If tests were
not added,
please describe why they were not added and/or why it was difficult to
add.
-->
New spec run via ng test (Vitest): 22 tests pass. eslint and prettier
checks clean.

### Was this PR authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this
PR,
please include the phrase: 'Generated-by: ' followed by the name of the
tool
and its version. If no, write 'No'. 
Please refer to the [ASF Generative Tooling
Guidance](https://www.apache.org/legal/generative-tooling.html) for
details.
-->
 Generated-by: Claude Code (Claude Opus 4.8)
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 10, 2026
)

### What changes were proposed in this PR?

Removes the unused parts of the agent panel's
`ReActStepDetailModalComponent`. **+1/−97 lines.** There is no behaviour
change.

- **The `agentId` input.** `agent-chat` binds it, but neither the
modal's class nor its template reads it, so the binding goes too.
- **`getMessageRoleColor` and `getToolCallStrings`,** with the private
`formatAsFunction` that only the latter calls. The template never calls
them. Only their own spec cases did, and those three cases go with them.
- **`react-step-detail-modal.component.scss` and its `styleUrls`
entry.** The file holds only the license header and one comment, so it
emits no styles.

The helpers the template does call (`getTextFromMessage`,
`getToolCallSummaries`, the tool-result and operator-access helpers) and
their spec cases stay.

### History

| | |
| --- | --- |
| **Introduced by** | apache#4495 (2026-04-28), "feat(agent-service): add
`agent-service` that manages LLM agents", together with the modal |
| **Usage removed by** | **never used**. Only spec cases (apache#5612) ever
called the two helpers |

They have been unused for the six months since they were added.

### Any related issues, documentation, discussions?

Closes apache#9392.

### How was this PR tested?

No new tests. The modal's remaining cases stay.

From `frontend/`:

- `npx ng test --watch=false
--include='**/react-step-detail-modal.component.spec.ts'
--include='**/agent-chat.component.spec.ts'
--include='**/agent-panel.component.spec.ts'`: 3 files, 125 tests, all
pass. The last two specs cover the modal's host (`agent-chat`) and the
panel around it.
- `npx tsc --noEmit -p src/tsconfig.app.json` and `-p
src/tsconfig.spec.json`: clean.
- `yarn format:ci`: clean.
- `yarn build` (production, AOT): success.

To re-check:

```
git grep -n -E "getMessageRoleColor|getToolCallStrings|formatAsFunction|react-step-detail-modal.component.scss"   # no hits
git grep -n agentId -- frontend/src/app/workspace/component/agent/agent-panel/react-step-detail-modal   # no hits
```

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for ReActStepDetailModalComponent

5 participants