Skip to content

Add unit tests for labels, links, and topology rollout actions - #301

Open
trdoyle81 wants to merge 1 commit into
redhat-developer:mainfrom
trdoyle81:GITOPS-10539-GITOPS-10537-UI-Components-Topology-dropdown-actions
Open

Add unit tests for labels, links, and topology rollout actions#301
trdoyle81 wants to merge 1 commit into
redhat-developer:mainfrom
trdoyle81:GITOPS-10539-GITOPS-10537-UI-Components-Topology-dropdown-actions

Conversation

@trdoyle81

Copy link
Copy Markdown
Member

Adds unit tests for shared UI components and topology rollout dropdown actions.

Covers:
-MetadataLabels: custom numLabels
-ExternalLink: missing text, children vs text, empty children
-Topology actions: delete rollout id/label + modal callback; edit rollout yaml href (inc missing name/namespace)

Jira:
https://redhat.atlassian.net/browse/GITOPS-10537
https://redhat.atlassian.net/browse/GITOPS-10539

Will need to be ported to release-4.18 aswell.

Run tests:
$ pnpm test
$ pnpm test -- src/gitops/components/shared/MetadataLabels/MetadataLabels.test.tsx src/gitops/utils/components/ExternalLink/ExternalLink.test.tsx src/gitops/topology/actions/creators.test.ts

Signed-off-by: trdoyle <trdoyle@redhat.com>
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: be59a246-6d9f-41f1-849e-d8d918dee0c0

📥 Commits

Reviewing files that changed from the base of the PR and between 0a2a15c and 471e383.

📒 Files selected for processing (3)
  • src/gitops/components/shared/MetadataLabels/MetadataLabels.test.tsx
  • src/gitops/topology/actions/creators.test.ts
  • src/gitops/utils/components/ExternalLink/ExternalLink.test.tsx

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Tests
    • Expanded coverage for custom metadata label counts.
    • Added validation for topology delete actions and edit links with incomplete metadata.
    • Added coverage for external links with missing text, child content, and empty children.

Walkthrough

The changes expand tests for MetadataLabels, topology action creators, and ExternalLink. They cover custom label counts, delete modal callbacks, incomplete rollout metadata, and external link content precedence.

Changes

Test coverage updates

Layer / File(s) Summary
Metadata label count rendering
src/gitops/components/shared/MetadataLabels/MetadataLabels.test.tsx
Tests verify that numLabels={3} renders as data-num-labels="3".
Topology action creator behavior
src/gitops/topology/actions/creators.test.ts
Tests verify delete modal callback invocation and edit-action hrefs when rollout namespace or name metadata is missing.
External link content rendering
src/gitops/utils/components/ExternalLink/ExternalLink.test.tsx
Snapshot tests cover missing text, child precedence over text, and empty-child rendering.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 471e3

This change adds coverage for shared UI rendering and topology rollout actions without modifying production behavior. No current merge-readiness risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding unit tests for labels, links, and topology rollout actions.
Description check ✅ Passed The description is related to the changeset and identifies the tested components, coverage, Jira issues, and test commands.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files.


Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 12.79%. Comparing base (3bd1dab) to head (471e383).
⚠️ Report is 53 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   11.30%   12.79%   +1.49%     
==========================================
  Files         169      172       +3     
  Lines        6679     6838     +159     
  Branches     2235     2308      +73     
==========================================
+ Hits          755      875     +120     
+ Misses       5923     5722     -201     
- Partials        1      241     +240     
Flag Coverage Δ
unit-tests 12.79% <ø> (+1.49%) ⬆️

Flags with carried forward coverage won't be shown. 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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants