Skip to content

Mirrors page tests#569

Merged
ethanashaw merged 2 commits intodeb-archivefrom
mirrors-tests
Apr 27, 2026
Merged

Mirrors page tests#569
ethanashaw merged 2 commits intodeb-archivefrom
mirrors-tests

Conversation

@ethanashaw
Copy link
Copy Markdown
Contributor

@ethanashaw ethanashaw commented Apr 24, 2026

Tests for mirrors page

Also fixed profile side panel tests, which weren't updated to use the newly renamed name param

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 23:14
@ethanashaw ethanashaw self-assigned this Apr 24, 2026
@ethanashaw ethanashaw requested a review from a team April 24, 2026 23:15
Copy link
Copy Markdown
Contributor

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

Adds/updates unit tests around the Mirrors UI, while adjusting a few helpers and MSW handlers to better support Mirrors page behavior in tests.

Changes:

  • Added Vitest coverage for multiple Mirrors components (list, details, actions, modals, counts, form flows).
  • Updated Mirrors list/actions rendering to handle missing mirror names and pass explicit props to actions.
  • Tweaked utilities/mocks/MSW handlers to align with Mirrors page data shapes and URL/query-param conventions.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils/output.ts Makes boolToLabel accept optional boolean (used by Mirrors details).
src/utils/_helpers.ts Allows pluralizeNew to be called with an omitted/undefined count via default param.
src/tests/server/handlers/mirrors.ts Improves MSW mirror GET handling (lookup by id, returns 404 when missing) and aligns param naming.
src/tests/mocks/ubuntuArchiveInfo.ts Adds a new Ubuntu Pro service fixture used by Mirrors UI tests.
src/features/wsl-profiles/components/WslProfileEditSidePanel/WslProfileEditSidePanel.test.tsx Updates tests to use name query param.
src/features/wsl-profiles/components/WslProfileDetailsSidePanel/WslProfileDetailsSidePanel.test.tsx Updates tests to use name query param.
src/features/upgrade-profiles/components/UpgradeProfileDetailsSidePanel/UpgradeProfileDetailsSidePanel.test.tsx Updates tests to use name query param.
src/features/security-profiles/components/SecurityProfileDownloadAuditSidePanel/SecurityProfileDownloadAuditSidePanel.test.tsx Updates tests to use name query param.
src/features/security-profiles/components/SecurityProfileDetailsSidePanel/SecurityProfileDetailsSidePanel.test.tsx Updates tests to use name query param.
src/features/removal-profiles/components/RemovalProfileEditSidePanel/RemovalProfileEditSidePanel.test.tsx Updates tests to use name query param.
src/features/removal-profiles/components/RemovalProfileDetailsSidePanel/RemovalProfileDetailsSidePanel.test.tsx Updates tests to use name query param.
src/features/reboot-profiles/components/RebootProfileEditSidePanel/RebootProfileEditSidePanel.test.tsx Updates tests to use name query param.
src/features/reboot-profiles/components/RebootProfileDuplicateSidePanel/RebootProfileDuplicateSidePanel.test.tsx Updates tests to use name query param.
src/features/reboot-profiles/components/RebootProfileDetailsSidePanel/RebootProfileDetailsSidePanel.test.tsx Updates tests to use name query param.
src/features/package-profiles/components/PackageProfileEditSidePanel/PackageProfileEditSidePanel.test.tsx Updates tests to use name query param.
src/features/package-profiles/components/PackageProfileDetailsSidePanel/PackageProfileDetailsSidePanel.test.tsx Updates tests to use name query param.
src/features/mirrors/components/UpdateMirrorModal/UpdateMirrorModal.test.tsx Adds tests for update modal behavior (but has an assertion issue).
src/features/mirrors/components/SelectableMirrorContentsBlock/SelectableMirrorContentsBlock.test.tsx Adds render-focused tests for selectable contents block.
src/features/mirrors/components/RemoveMirrorModal/RemoveMirrorModal.test.tsx Adds tests for remove modal (publications list + delete action).
src/features/mirrors/components/MirrorsList/MirrorsList.tsx Renders actions column as NoData when mirror.name is missing; passes explicit action props.
src/features/mirrors/components/MirrorsList/MirrorsList.test.tsx Adds tests for list rendering with/without data.
src/features/mirrors/components/MirrorPublicationsList/MirrorPublicationsList.test.tsx Adds a smoke test for publications list rendering.
src/features/mirrors/components/MirrorPublicationsLink/MirrorPublicationsLink.test.tsx Adds tests for publications link count rendering.
src/features/mirrors/components/MirrorPackagesCount/MirrorPackagesCount.tsx Uses pluralizeNew defaulting behavior when packages list is absent.
src/features/mirrors/components/MirrorPackagesCount/MirrorPackagesCount.test.tsx Adds tests for exact vs limited package count display.
src/features/mirrors/components/MirrorDetails/MirrorDetails.tsx Uses boolToLabel for boolean labels in the details panel.
src/features/mirrors/components/MirrorDetails/MirrorDetails.test.tsx Adds a smoke test for details panel rendering/loading.
src/features/mirrors/components/MirrorActions/MirrorActions.tsx Refactors actions to accept mirrorName/mirrorDisplayName instead of full Mirror object.
src/features/mirrors/components/MirrorActions/MirrorActions.test.tsx Adds a render smoke test for actions component.
src/features/mirrors/components/EditMirrorForm/EditMirrorForm.test.tsx Adds tests for editing different mirror source types.
src/features/mirrors/components/AddMirrorForm/AddMirrorForm.tsx Changes how components/architectures inputs are edited (string input ↔ array state) and simplifies sourceType change logic.
src/features/mirrors/components/AddMirrorForm/AddMirrorForm.test.tsx Adds tests for adding mirrors across source types.
Comments suppressed due to low confidence (2)

src/features/mirrors/components/AddMirrorForm/AddMirrorForm.tsx:263

  • Same issue as the Components field: the custom onBlur replaces Formik’s blur handler, so architectures may not become touched, which can suppress validation errors from getFormikError until submit. Call formik.handleBlur(event) (or set touched explicitly) alongside the normalization.
                    onBlur={async (event) => {
                      await formik.setFieldValue(
                        "architectures",
                        event.target.value.split(", ").filter(Boolean),
                      );
                    }}

src/features/mirrors/components/AddMirrorForm/AddMirrorForm.tsx:243

  • The custom onBlur handler overrides Formik’s default blur handling from getFieldProps, so the field may never be marked as touched. That can prevent getFormikError from surfacing validation errors until submit. Consider calling formik.handleBlur(event) (or setFieldTouched) in addition to your normalization logic.
                    onBlur={async (event) => {
                      await formik.setFieldValue(
                        "components",
                        event.target.value.split(", ").filter(Boolean),
                      );
                    }}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/features/mirrors/components/UpdateMirrorModal/UpdateMirrorModal.test.tsx Outdated
Comment thread src/features/mirrors/components/AddMirrorForm/AddMirrorForm.tsx
…Modal.test.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@marqode marqode left a comment

Choose a reason for hiding this comment

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

Mirror tests all lgtm! When I ran with coverage locally I see some gaps on the following:

  • PublishMirrorForm missing test file
  • VSCode coverage tool shows <=60% coverage of useCreateMirror, useDeleteMirror, useListMirror, useSyncMirror, useUpdateMirror and useDistribution

I'm not sure how thoroughly we try to cover hooks / api calls at this stage.

@ethanashaw
Copy link
Copy Markdown
Contributor Author

Thanks @marqode! The PublishMirrorForm is still a placeholder, I will address that one in a new pull request. I'll also look into covering the API hooks separately.

@ethanashaw ethanashaw merged commit 9a2bf78 into deb-archive Apr 27, 2026
@ethanashaw ethanashaw deleted the mirrors-tests branch April 27, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants