[quality] Fix mission-control test mocks with missing MissionControlState fields#20563
Conversation
|
[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. |
|
🐝 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. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
✅ 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 updates Mission Control component unit tests to match the newly-required MissionControlState and ClusterAssignment shapes, preventing crashes like TypeError: Cannot read properties of undefined (reading 'flatMap') when components access state.launchProgress.
Changes:
- Updated
MissionControlStatetest mocks to include new required fields (e.g.,phase,title,overlay,deployMode,targetClusters,aiStreaming,launchProgress). - Updated
ClusterAssignmenttest mocks to include new required fields (e.g.,clusterContext,provider,readiness). - Added a
FlightPlanBlueprinttest case covering a non-emptylaunchProgressstate and wired required callback props.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| web/src/components/mission-control/LaunchSequence.test.tsx | Updates test state mock to include newly-required Mission Control fields (but still needs additional test harness fixes per review comments). |
| web/src/components/mission-control/FlightPlanBlueprint.test.tsx | Updates test state mock and component props; adds coverage for a state with active launchProgress. |
Comments suppressed due to low confidence (1)
web/src/components/mission-control/LaunchSequence.test.tsx:63
LaunchSequencedoes not renderstate.descriptionin the UI (it’s only used when composing the unified mission prompt). This assertion will fail once the render crashes are fixed; assert on a UI element that is actually rendered, such as the launch header title key.
launchProgress: [],
}
describe('LaunchSequence', () => {
it('renders mission description', () => {
| const mockState: MissionControlState = { | ||
| phase: 'launching', | ||
| description: 'Test deployment', | ||
| title: 'Test Launch', | ||
| projects: [ |
| overlay: 'architecture', | ||
| deployMode: 'phased', | ||
| targetClusters: [], | ||
| aiStreaming: false, | ||
| launchProgress: [], |
…tate fields The MissionControlState interface was extended with required fields (phase, title, overlay, deployMode, targetClusters, aiStreaming, launchProgress) but the test mock was not updated, causing TypeError: Cannot read properties of undefined (reading 'flatMap') at line 706 where state.launchProgress.flatMap() is called. Also adds missing onOverlayChange and onDeployModeChange props and a new test case for active launch progress state. Partially addresses #20553 Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nControlState fields Same root cause as FlightPlanBlueprint — the MissionControlState was extended with required fields but test mocks were not updated. Adds phase, title, overlay, deployMode, targetClusters, aiStreaming, launchProgress, and fixes ClusterAssignment to include clusterContext, provider, and readiness. Partially addresses #20553 Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2a359a3 to
b0a976b
Compare
|
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 Verification: passedCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Test Improvement
Fixes the
TypeError: Cannot read properties of undefined (reading 'flatMap')inFlightPlanBlueprintandLaunchSequencetests.Root Cause
The
MissionControlStateinterface was extended with required fields (phase,title,overlay,deployMode,targetClusters,aiStreaming,launchProgress) andClusterAssignmentgained required fields (clusterContext,provider,readiness), but the test mock objects were not updated. The component accessesstate.launchProgress.flatMap(...)at line 706, crashing on undefined.Changes
FlightPlanBlueprint.test.tsxLaunchSequence.test.tsxRemaining work
Other tests in
__tests__/interactive-components.test.tsxand__tests__/mission-control-dialog.test.tsxmay need similar updates — they're large files requiring individual analysis.Partially addresses #20553
Filed by quality agent (ACMM L4/L6 — full mode)