Skip to content

Conversation

@andreaskienle
Copy link
Contributor

@andreaskienle andreaskienle commented Oct 23, 2025

This PR adds tests to the create MCP flow:

  • Offloads creation logic to useCreateManagedControlPlane with dedicated tests
  • Mocks this hook in CreateManagedControlPlaneWizardContainer with dedicated tests

It also adds some helper utils which can be used in similar tests:

  • deepEqualJson Command for cypress
  • assertNonNullish and assertString vor vitest

Copilot AI review requested due to automatic review settings October 23, 2025 08:41
Copy link
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

This PR introduces a new custom hook useCreateManagedControlPlane to handle the creation of Managed Control Planes, along with comprehensive test coverage and dependency injection support for improved testability.

Key Changes

  • Created useCreateManagedControlPlane hook to encapsulate MCP creation logic
  • Added unit tests for the new hook using Vitest
  • Implemented Cypress component tests for the wizard container with dependency injection
  • Introduced test utilities for type assertions in test files

Reviewed Changes

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

Show a summary per file
File Description
src/utils/test/vitest-utils.ts New test utility functions for type assertions in Vitest tests
src/hooks/useCreateManagedControlPlane.tsx New hook abstracting MCP creation mutation logic
src/hooks/useCreateManagedControlPlane.spec.ts Unit tests validating the hook's request handling
src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx Integrated new hook with dependency injection for testability
src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.cy.tsx Cypress component test for end-to-end wizard flow
cypress/support/commands.ts Added custom Cypress command for deep JSON equality assertions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP left a comment

Choose a reason for hiding this comment

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

Really good job with find a good way to test our components!

@andreaskienle andreaskienle merged commit c22e0ba into main Oct 24, 2025
5 checks passed
@andreaskienle andreaskienle deleted the test-create-mcp branch October 24, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants