Add MSW coverage for Duo chat tool calls
What
Leaf MR in the Duo Agentic Chat MSW migration. Covers tool-call rendering and the tool-approval round trip in jsdom, ahead of removing the Capybara examples it replaces.
Independent of the other MRs in this series; see the table at the end.
Replaces
The last MR in the series
!244590 (merged) will remove these Capybara specs once we can ensure equivalent coverage using MSW integration specs
| Capybara example | Replaced by |
|---|---|
allows user to ask about entity |
tool_call_rendering_spec.js |
allows user to create a new entity (UI half) |
tool_approval_spec.js |
Both specs are about tool_info reaching message_tool.vue / message_tool_approval.vue through message_map.vue — one is the completed-call render, the other the pending-call render plus the approve round trip.
What stays in Capybara
allows user to create a new entity also asserted ::MergeRequest.exists?(...) — that an approved tool call reaches Postgres through the real duo-workflow-service and GitLab API. That assertion cannot move to jsdom and survives as the single remaining Capybara example, in the final MR of this series.
Notes on the checkpoint shapes
The approved-tool checkpoint includes the executed tool message after the request, not just the request flipped to success. toolDenialTransformer uses that trailing tool message to tell an approved request from a denied one; without it the card finalises as "Cancelled" rather than "Approved". Worth knowing if you write further approval specs.
Verification
yarn jest:msw-integration ee/spec/frontend/msw_integration/duo_agentic_chat/ — green.
Notes
Test-only, so no changelog entry.
Part of #603605 (closed)
The MR series
| # | MR | What it does | Status |
|---|---|---|---|
| 1 | !248777 (merged) | Sets up MSW test foundations | Merged |
| 2 | !248782 (merged) | Covers the AI panel shell | Merged |
| 3 | !248783 (merged) | Covers the chat conversation lifecycle | Open |
| 4 | !248785 | Covers chat tool calls | Open — this MR |
| 5 | !248787 (merged) | Covers agent and model selection | Open |
| 6 | !248791 (merged) | Covers additional context | Open |
| 7 | !244590 (merged) | Removes the replaced Capybara specs | Draft |
Related issue: #603605 (closed)
The four spec MRs (3-6) are independent and can be reviewed and merged in parallel, in any order. Several add helpers to the same two shared test files, so whichever merges first leaves the others a trivial rebase: inserts in the same place, never disagreements. !244590 (merged) merges last, since it deletes the Capybara coverage the others replace.