diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/ProjectSelector/ProjectSelector.test.tsx b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/ProjectSelector/ProjectSelector.test.tsx index dbc86e22fb59..61cfd57204ac 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/ProjectSelector/ProjectSelector.test.tsx +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/ProjectSelector/ProjectSelector.test.tsx @@ -15,7 +15,6 @@ const pciProjects : Array> = [ ]; const onProjectChange = vi.fn(); -const onProjectCreate = vi.fn(); const onSeeAllProjects = vi.fn(); const onMenuOpen = vi.fn(); @@ -24,10 +23,8 @@ const props: Props = { projects: pciProjects as Array, selectedProject: pciProjects[0] as PciProject, onProjectChange: onProjectChange, - onProjectCreate: onProjectCreate, onSeeAllProjects: onSeeAllProjects, onMenuOpen: onMenuOpen, - createLabel: "Créer un projet", seeAllButton: true, seeAllLabel: "Tous mes projets Public Cloud", } @@ -38,9 +35,7 @@ const renderProjectSelector = (props: Props) => { projects={props.projects} selectedProject={props.projects[0]} onProjectChange={props.onProjectChange} - onProjectCreate={props.onProjectCreate} onSeeAllProjects={props.onSeeAllProjects} - createLabel={props.createLabel} seeAllButton={props.seeAllButton} seeAllLabel={props.seeAllLabel} />); diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.test.tsx b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.test.tsx index 4c63a32a05a9..782898809858 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.test.tsx +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.test.tsx @@ -1,8 +1,8 @@ import { vi, it, describe, expect } from 'vitest'; -import { render, waitFor } from '@testing-library/react'; +import { render, act, fireEvent } from '@testing-library/react'; import { Node } from '../navigation-tree/node'; import { PublicCloudPanel, PublicCloudPanelProps } from './PublicCloudPanel'; -import { mockShell } from '../mocks/sidebarMocks'; +import { mockShell, mockPlugins } from '../mocks/sidebarMocks'; import { PciProject } from '../ProjectSelector/PciProject'; import { Props as ProjectSelectorProps } from '../ProjectSelector/ProjectSelector'; import { pciNode } from '../navigation-tree/services/publicCloud'; @@ -105,4 +105,12 @@ describe('PublicCloudPanel.component', () => { expect(projectSelector).not.toBeNull(); expect(projectSelector.innerHTML).toBe('12345'); }); + + it('should navigate to project creation when the button is clicked', async () => { + const { queryByTestId } = renderPublicCloudPanelComponent(props); + const createButton = queryByTestId('pci-create-project'); + await act(() => fireEvent.click(createButton)); + + expect(mockPlugins.navigation.navigateTo).toHaveBeenCalled(); + }) }); diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.tsx b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.tsx index d40410d8d6c8..02e0fdf7293c 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.tsx +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SubTree/PublicCloudPanel.tsx @@ -202,6 +202,7 @@ export const PublicCloudPanel: React.FC navigationPlugin.navigateTo('public-cloud', `#/pci/projects/new`)