[quality] Add unit tests for PipelineFilterContext mergeRepos and sidebar-customizer routes#20540
Conversation
Adds `export` to the pure `mergeRepos` function and `StoredRepoConfig` interface — no logic change, enables direct unit testing. Signed-off-by: clubanderson <club.anderson@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests the pure mergeRepos function covering: empty config, hidden repos, user-added repos, combined add+hide, duplicate prevention, and order. Signed-off-by: clubanderson <club.anderson@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ants Tests buildKnownRoutes pure function: field completeness, href format, uniqueness, translation key format, and enterprise sub-routes presence. Also validates sidebar constants for reasonable bounds. Signed-off-by: clubanderson <club.anderson@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
✅ Test Coverage CheckAll new source files in this PR have corresponding test files. Checked |
♿ Accessibility Audit (WCAG 2.1 AA)✅ No WCAG 2.1 AA violations detected in audited routes. Powered by axe-core. Target: WCAG 2.1 AA compliance. |
There was a problem hiding this comment.
Pull request overview
This PR improves frontend test coverage by adding unit tests for two previously low-covered areas: the pipelines repo filter merge logic and the sidebar-customizer known-routes builder. It also makes small source adjustments to enable testing of the pipelines merge helper.
Changes:
- Added unit tests for
mergeReposinPipelineFilterContext(hidden/added/ordering/edge cases). - Added unit tests for
buildKnownRoutesplus basic invariants around sidebar-customizer constants. - Exported
mergeReposandStoredRepoConfigfromPipelineFilterContext.tsxto support direct unit testing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| web/src/components/layout/sidebar-customizer/tests/knownRoutes.test.ts | Adds unit tests for buildKnownRoutes and sidebar-customizer constants. |
| web/src/components/cards/pipelines/PipelineFilterContext.tsx | Exports mergeRepos and StoredRepoConfig for testability (no logic change). |
| web/src/components/cards/pipelines/tests/PipelineFilterContext.test.ts | Adds unit tests covering mergeRepos behavior across common and edge cases. |
| it('includes enterprise sub-routes', () => { | ||
| const routes = buildKnownRoutes(mockT) | ||
| const enterpriseRoutes = routes.filter(r => r.href.startsWith('/enterprise')) | ||
| expect(enterpriseRoutes.length).toBeGreaterThan(5) | ||
| }) |
| /** Merge server repos + user config into the visible list */ | ||
| function mergeRepos(serverRepos: string[], config: StoredRepoConfig): string[] { | ||
| export function mergeRepos(serverRepos: string[], config: StoredRepoConfig): string[] { | ||
| const hidden = new Set(config.hidden) |
…xport Add eslint-disable-next-line to mergeRepos export to satisfy the react-refresh/only-export-components rule. mergeRepos is a helper used by tests and other files; keeping it here alongside the context avoids churn to imports across the codebase. Signed-off-by: kubestellar-hive[bot] <197575415+kubestellar-hive[bot]@users.noreply.github.com>
…ble comment The eslint-disable-next-line comment added in the previous commit shifted all subsequent line numbers by one, causing existing baseline violations to appear as new violations in the lint-baseline-check. Update the baseline so react-hooks/exhaustive-deps entries for PipelineFilterContext.tsx reflect the new line positions (131→132, 135→136, 176→177, 188→189, 199→200), and the react-refresh entry for usePipelineFilter shifts from 238 to 239. Also remove the now-suppressed react-refresh violation for mergeRepos which is silenced by the eslint-disable-next-line comment. Signed-off-by: kubestellar-hive[bot] <197575415+kubestellar-hive[bot]@users.noreply.github.com> Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
❌ Playwright Tests Failed📊 View Full ReportDownload the To view the report locally: # Download and extract playwright-report.zip
npx playwright show-report path/to/playwright-report |
Resolve conflict in PipelineFilterContext.tsx where main moved mergeRepos to pulse-utils.ts. Update the added PipelineFilterContext.test.ts to import mergeRepos from pulse-utils while keeping StoredRepoConfig type import from PipelineFilterContext. Also picks up main's improvements, resolving the dirty/conflicting merge state so this PR can proceed. Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
The react-hooks/exhaustive-deps violation for the resetToDefaults useCallback in PipelineFilterContext.tsx is at line 176, col 6. The baseline incorrectly recorded it as line 177 after the PR's line-number shift, causing CI to report it as a new violation. Signed-off-by: Scanner Bot <scanner@hive.local>
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Test Improvement
Adds unit tests for the pipeline filter context and sidebar-customizer modules identified in #20512 as having low coverage.
New test files
web/src/components/cards/pipelines/__tests__/PipelineFilterContext.test.tsmergeRepos— server repos + user-added - hidden logicweb/src/components/layout/sidebar-customizer/__tests__/knownRoutes.test.tsbuildKnownRoutesmapping + constants validationSource changes
PipelineFilterContext.tsx: AddedexporttomergeReposfunction andStoredRepoConfiginterface (no logic change)What this validates
mergeRepospure function that determines which repos appear in the filter bar — hidden repos exclusion, user-added repos appending, duplicate prevention, order preservation, and edge cases (all hidden, already in server list, hidden+added overlap)buildKnownRoutesroute construction — field completeness, href uniqueness, translation key format, enterprise sub-route presence; constants bounds validationPartially addresses #20512
Filed by quality agent (ACMM L4/L6 — full mode)