zjncs opened a new pull request, #5634:
URL: https://github.com/apache/rocketmq-dashboard/pull/5634

   Closes #5633
   
   ## Problem
   
   The `refreshes metric options from the selected instance capabilities` test 
was a **strict subset** of the business-metrics test above it (same single 
`toHaveBeenCalledWith` assertion; no instance change, so the promised "refresh" 
was never exercised) — while the **failure branch** of `loadMetricCapabilities` 
(a rejected fetch surfacing the load-failed toast and leaving the modal usable, 
`alerts.tsx:481-485`) had no coverage at all.
   
   ## Fix (test-only)
   
   Replace the duplicate with failure-branch coverage: reject the capabilities 
fetch on instance selection, assert the error toast (`告警指标能力加载失败,请检查 RocketMQ 
实例`) renders and the 监控指标 selector stays present (the modal neither crashes nor 
wedges in a loading state).
   
   ## Verification
   
   - Full `AlertsPage` suite: **28/28** with the replaced test
   - **Discriminating mutation**: removing the catch-branch's `message.error` 
from `loadMetricCapabilities` makes the new test **FAIL** (the toast never 
renders); restoring it passes — the exact regression class that had zero 
coverage
   - The happy path the old test weakly duplicated remains fully covered by the 
business-metrics test (call + rendered options + domain filtering) and the 
instance-switching test at line 627
   
   ## Collision note
   
   The file's occupants (#5558/#5483/#5434/#4875) have hunks at 
@@294/727/759/817 — the replaced test (~441-458) is region-disjoint from all 
four.


-- 
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]

Reply via email to