[scanner] 🐛 fix: update CreateNamespaceModal test for auto-select cluster#21354
Conversation
…ster behavior PR #21318 changed CreateNamespaceModal to auto-select the first cluster (clusters[0]) instead of the empty placeholder. The test still asserted the old placeholder behavior, causing shard 3 failures in Coverage Suite on main. Rename `initializes with cluster placeholder selected` → `auto-selects first cluster on initialization`, and assert the combobox value is 'cluster-1' instead of ''. Test-only change; no component code touched. Signed-off-by: clubanderson <407614+clubanderson@users.noreply.github.com>
|
[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 |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 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 |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
♿ 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. |
⏹️ Post-Merge Verification: cancelledCommit: |
There was a problem hiding this comment.
Pull request overview
Updates the CreateNamespaceModal unit test to match the post-#21318 behavior where the first cluster is auto-selected on mount, resolving the stale assertion called out in #21343.
Changes:
- Renamed the initialization test to reflect auto-selection behavior.
- Updated the expected initial
<select>value from''to the first cluster (cluster-1).
| const comboboxes = screen.getAllByRole('combobox') | ||
| expect(comboboxes.length).toBeGreaterThan(0) | ||
| expect((comboboxes[0] as HTMLSelectElement).value).toBe('') | ||
| expect((comboboxes[0] as HTMLSelectElement).value).toBe('cluster-1') |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
…d CanIChecker (#21363) Both components initialised their cluster state to '' while their tests (updated by PRs #21344 and #21354) assert auto-selection of the first available cluster. This mismatch caused the nightly unit-test suite to fail on every run since the revert in PR #21323. CreateNamespaceModal: change useState('') → useState(clusters[0] ?? '') so the first cluster prop is selected on mount, matching the assertion in 'auto-selects first cluster on initialization'. CanIChecker: memoize the clusters array with useMemo to stabilise the dependency reference, then add a useEffect that dispatches SET_FIELD for 'cluster' when clusters become available and no cluster is selected yet, matching 'auto-selects the first cluster'. Fixes #21083 Signed-off-by: Scanner Agent <scanner@agents.github.com> Co-authored-by: Scanner Agent <scanner@agents.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes #21343
Updates CreateNamespaceModal test for the auto-select-first-cluster behavior introduced in #21318. Supersedes #21350 for the CreateNamespaceModal piece (CanIChecker fixed by #21344, EnterpriseComplianceCards by #21346).
Test-only change; no component code touched.