-
Notifications
You must be signed in to change notification settings - Fork 3
test: create/delete project #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…mcp-project/ui-frontend into test/create-delete-projects
There was a problem hiding this 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 refactors project deletion and creation logic by extracting them into custom hooks (useDeleteProject and useCreateProject). The refactoring improves testability by allowing dependency injection of hooks in components.
- Extracted project deletion logic into
useDeleteProjecthook - Extracted project creation logic into
useCreateProjecthook - Updated components to use the new hooks with optional parameters for testing
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/hooks/useDeleteProject.ts | New hook that encapsulates project deletion logic |
| src/hooks/useDeleteProject.spec.ts | Unit tests for the delete project hook |
| src/hooks/useCreateProject.ts | New hook that encapsulates project creation logic |
| src/hooks/useCreateProject.spec.ts | Unit tests for the create project hook |
| src/components/Projects/ProjectsListItemMenu.tsx | Refactored to use useDeleteProject hook with dependency injection |
| src/components/Projects/ProjectsListItemMenu.cy.tsx | Component test for delete functionality |
| src/components/Dialogs/CreateProjectDialogContainer.tsx | Refactored to use useCreateProject hook with dependency injection |
| src/components/Dialogs/CreateProjectDialogContainer.cy.tsx | Component test for create functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const { t } = useTranslation(); | ||
| const toast = useToast(); | ||
|
|
||
| const { trigger } = useApiResourceMutation<DeleteWorkspaceType>(DeleteProjectResource(projectName)); |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type mismatch: DeleteProjectResource is used with the generic type DeleteWorkspaceType, which has properties name and namespace for workspaces. Since this is for deleting projects (not workspaces), the type should be aligned with the project deletion resource or use a more appropriate type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old coding used the same data structure. We’ll rework the types with the move to GraphQL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check out CoPilot's comment but I think we're good.
Even added some tests for the not-so-straightforward case, nice 👍🏻
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: