Skip to content

Conversation

@jkowalski
Copy link
Contributor

No description provided.

@jkowalski jkowalski requested a review from Copilot June 7, 2025 04:16
Copy link

Copilot AI left a comment

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 refactors UI utilities by extracting policy-related helpers into a dedicated policyutil module and updating all imports and tests accordingly.

  • Extract policy functions (isAbsolutePath, checkPolicyPath, sourceQueryStringParams, PolicyTypeName, policyEditorURL, PolicyEditorLink) from uiutil into policyutil
  • Update source imports in pages and components to reference policyutil
  • Migrate and reorganize tests: remove policy tests from uiutil tests, add tests in policyutil, and introduce a standalone component test for PolicyEditorLink

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/utils/uiutil.test.js Removed policy-related tests from uiutil
tests/utils/uiutil-components.test.jsx Updated to only test sizeWithFailures; removed policy tests
tests/utils/policyutil.test.js Added comprehensive tests for new policyutil functions
tests/components/PolicyEditorLink.test.jsx Added component tests for PolicyEditorLink
src/utils/uiutil.jsx Removed policy utils and Link import
src/utils/policyutil.jsx New module exporting extracted policy helper functions
src/pages/Snapshots.jsx Updated imports: split uiutil and policyutil
src/pages/SnapshotHistory.jsx Changed sourceQueryStringParams import to policyutil
src/pages/Policy.jsx Updated PolicyTypeName import to policyutil
src/pages/Policies.jsx Updated checkPolicyPath & policyEditorURL imports to policyutil
src/components/policy-editor/PolicyEditor.jsx Updated imports: pull policy helpers from policyutil and component
Comments suppressed due to low confidence (2)

tests/utils/uiutil-components.test.jsx:4

  • The import resetRouterMocks is no longer used in this test file. Consider removing it to keep imports clean.
import { resetRouterMocks } from "../react-router-mock.jsx";

tests/utils/uiutil-components.test.jsx:9

  • [nitpick] This vi.mock setup appears to mock routing but the file only tests sizeWithFailures. You may remove the router mock block to simplify the test.
vi.mock("react-router-dom", async () => {

return "Directory: " + s.userName + "@" + s.host + ":" + s.path;
}

export function sourceQueryStringParams(src) {
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider handling undefined or null source properties so the query string doesn’t contain literal undefined or null, e.g. defaulting to an empty string or omitting parameters.

Copilot uses AI. Check for mistakes.
@jkowalski jkowalski merged commit ab8e622 into kopia:main Jun 7, 2025
2 checks passed
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.

1 participant