Skip to content

[scanner] 🐛 fix: update CreateNamespaceModal test for auto-select cluster#21354

Merged
clubanderson merged 1 commit into
mainfrom
scanner/fix-create-ns-modal-test
Jul 21, 2026
Merged

[scanner] 🐛 fix: update CreateNamespaceModal test for auto-select cluster#21354
clubanderson merged 1 commit into
mainfrom
scanner/fix-create-ns-modal-test

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

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.

…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>
Copilot AI review requested due to automatic review settings July 21, 2026 06:23
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 21, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign eeshaansa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit a44fccb
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a5f106cee854b00089e42de
😎 Deploy Preview https://deploy-preview-21354.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Hi @clubanderson! I'm kubestellar-hive[bot], an automation bot for this repo.

Trusted users — org members and contributors with write access — can mention @kubestellar-hive in a comment to trigger repo automation.
On issues, that mention queues an automated fix attempt. On pull requests, it records extra context for existing automation.
This is not an interactive Q&A bot, so mentions should be treated as requests for automation rather than a conversation.

Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies.

@kubestellar-prow kubestellar-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Check

All new source files in this PR have corresponding test files.

Checked web/src/hooks/ and web/src/components/ against origin/main.

@clubanderson
clubanderson merged commit 61366a2 into main Jul 21, 2026
40 of 43 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-create-ns-modal-test branch July 21, 2026 06:24
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

♿ 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.

@github-actions

Copy link
Copy Markdown
Contributor

⏹️ Post-Merge Verification: cancelled

Commit: 61366a2b71ac02d21066ae5b09b162116d7ef7ff
Specs run: NamespaceOverview.spec.ts smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/29806909831

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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')
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 61366a2b71ac02d21066ae5b09b162116d7ef7ff.

clubanderson added a commit that referenced this pull request Jul 21, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 3 test failure(s) in Coverage Suite run #4365

2 participants