Skip to content

GITOPS-10535: add unit tests for core string and URL utilities - #264

Open
trdoyle81 wants to merge 1 commit into
redhat-developer:mainfrom
trdoyle81:GITOPS-10535-console-plugin-core-data-test
Open

GITOPS-10535: add unit tests for core string and URL utilities#264
trdoyle81 wants to merge 1 commit into
redhat-developer:mainfrom
trdoyle81:GITOPS-10535-console-plugin-core-data-test

Conversation

@trdoyle81

@trdoyle81 trdoyle81 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Adds unit tests for core git string/URL helpers (stringHelpers, urls) covering happy paths and edge cases (empty/malformed URLs, SHA detection, provider parsing).

Some updates:

  • Quiets PatternFly mock React warnings in ActionDropDown tests
  • Enables esModuleInterop so git-url-parse default import works under Jest

Jira:
https://redhat.atlassian.net/browse/GITOPS-10535

Note:
Will need to be ported to release-4.18 also.

Run tests:
$ pnpm test
$ pnpm test -- src/gitops/utils/stringHelpers.test.ts src/gitops/utils/urls.test.ts

Signed-off-by: trdoyle <trdoyle@redhat.com>
@openshift-ci
openshift-ci Bot requested review from keithchong and wtam2018 August 14, 2026 13:45
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

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: a6eeed03-bbd2-409f-8fd2-af45fbbc25ea

📥 Commits

Reviewing files that changed from the base of the PR and between 89bc2b8 and 5247fe0.

📒 Files selected for processing (6)
  • __mocks__/patternfly-react-core.tsx
  • src/gitops/utils/components/ActionDropDown/ActionDropDown.test.tsx
  • src/gitops/utils/stringHelpers.test.ts
  • src/gitops/utils/urls.test.ts
  • src/gitops/utils/urls.ts
  • tsconfig.json

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved dropdown rendering so expanded state is reflected consistently and internal configuration props do not appear in the markup.
    • Improved compatibility when handling Git URL parsing and TypeScript modules.
  • Tests

    • Expanded coverage for Git URLs, repository providers, revisions, branches, malformed inputs, and unsupported formats.
    • Updated dropdown snapshots to reflect current rendered output.

Walkthrough

The change updates PatternFly mocks and action dropdown snapshots. It also expands Git URL parsing tests and configures TypeScript for the default git-url-parse import.

Changes

PatternFly mock behavior

Layer / File(s) Summary
Dropdown mock contract and snapshots
__mocks__/patternfly-react-core.tsx, src/gitops/utils/components/ActionDropDown/ActionDropDown.test.tsx
MenuToggle renders isExpanded as data-expanded. Dropdown omits internal props from the DOM. Divider is exported. Action dropdown snapshots validate the updated markup.

Git URL utility coverage

Layer / File(s) Summary
Git URL import and parsing coverage
tsconfig.json, src/gitops/utils/urls.ts, src/gitops/utils/stringHelpers.test.ts, src/gitops/utils/urls.test.ts
TypeScript enables CommonJS interoperability for the default git-url-parse import. Tests cover HTTP(S), SSH, provider detection, SHA values, revisions, unsupported inputs, and malformed URLs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 5247f

This PR adds unit coverage and test configuration updates without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the addition of unit tests for core Git string and URL utilities.
Description check ✅ Passed The description accurately covers the utility tests, PatternFly mock updates, and Jest interoperability changes.

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 11.34%. Comparing base (80b0f68) to head (5247fe0).
⚠️ Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
- Coverage   11.39%   11.34%   -0.05%     
==========================================
  Files         168      169       +1     
  Lines        6627     6679      +52     
  Branches     2274     2235      -39     
==========================================
+ Hits          755      758       +3     
- Misses       5635     5920     +285     
+ Partials      237        1     -236     
Flag Coverage Δ
unit-tests 11.34% <100.00%> (-0.05%) ⬇️

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