Skip to content

Commit

Permalink
Add delete unit test flow
Browse files Browse the repository at this point in the history
Signed-off-by: yubonluo <[email protected]>
  • Loading branch information
yubonluo committed Aug 21, 2024
1 parent b082ec2 commit 82b077c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ const WorkspaceDetailPage = (props: any) => {
dataSourceManagement,
navigationUI: {
HeaderControl: ({ controls }) => {
return controls?.[0].testId ?? null;
if (props.showDeleteModal && controls && controls[0] && controls[0].run) {
controls[0].run();
}
return null;
},
},
},
Expand Down Expand Up @@ -205,8 +208,19 @@ describe('WorkspaceDetail', () => {

it('delete button will been shown at page header', async () => {
const workspaceService = createWorkspacesSetupContractMockWithValue(workspaceObject);
const { getByText } = render(WorkspaceDetailPage({ workspacesService: workspaceService }));
expect(getByText('workspace-detail-delete-button')).toBeInTheDocument();
const { getByText, getByTestId } = render(
WorkspaceDetailPage({
workspacesService: workspaceService,
showDeleteModal: true,
})
);
expect(getByText('Delete workspace')).toBeInTheDocument();
const input = getByTestId('delete-workspace-modal-input');
fireEvent.change(input, {
target: { value: 'delete' },
});
const confirmButton = getByTestId('delete-workspace-modal-confirm');
fireEvent.click(confirmButton);
});

it('click on Collaborators tab when permission control and dataSource disabled', async () => {
Expand Down

0 comments on commit 82b077c

Please sign in to comment.