Skip to content

Commit

Permalink
changed name to blank
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Nov 15, 2024
1 parent f2e2f62 commit 4566b04
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
19 changes: 17 additions & 2 deletions src/containers/Flow/Flow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ const mocks = [
addRoleIds: [],
deleteRoleIds: [],
}),
copyFlowQuery({
isActive: true,
isPinned: false,
isBackground: false,
name: 'Help flow',
keywords: ['help'],
description: '',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
}),
];

const mockUseLocationValue: any = {
Expand Down Expand Up @@ -361,12 +372,16 @@ it('should create copy of a template flow', async () => {

const { container, getByTestId } = render(copyFlow());
await waitFor(() => {
const inputElement = container.querySelector('input[name="name"]') as HTMLInputElement;
expect(inputElement?.value).toBe('Copy of Help');
expect(screen.getByText('Template flow copy')).toBeInTheDocument();
});

const button = getByTestId('submitActionButton');
fireEvent.click(button);

const inputs = screen.getAllByRole('textbox');
fireEvent.change(inputs[0], { target: { value: 'Help flow' } });
fireEvent.change(inputs[1], { target: { value: 'help' } });

await waitFor(() => {});
});

Expand Down
9 changes: 3 additions & 6 deletions src/containers/Flow/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Flow = () => {
fieldName = `Copy of ${nameValue}`;
fieldKeywords = '';
} else if (location.state === 'copyTemplate') {
fieldName = `Copy of ${nameValue}`;
fieldName = '';
description = '';
tags = null;
fieldKeywords = '';
Expand Down Expand Up @@ -140,8 +140,7 @@ export const Flow = () => {
}
};

const regex =
/^\s*[^-!$%^&*()+|~=`{}[\]:";'<>?,./]+\s*(,\s*[^-!$%^&*()+|~=`{}[\]:";'<>?,./]+\s*)*$/g;
const regex = /^\s*[^-!$%^&*()+|~=`{}[\]:";'<>?,./]+\s*(,\s*[^-!$%^&*()+|~=`{}[\]:";'<>?,./]+\s*)*$/g;

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with ' ,' and containing many repetitions of ' \t,'.

const FormSchema = Yup.object().shape({
name: Yup.string().required(t('Name is required.')),
Expand Down Expand Up @@ -215,9 +214,7 @@ export const Flow = () => {
name: 'ignoreKeywords',
title: t('Ignore Keywords'),
info: {
title: t(
'If activated, users will not be able to change this flow by entering keyword for any other flow.'
),
title: t('If activated, users will not be able to change this flow by entering keyword for any other flow.'),
},
darkCheckbox: true,
className: styles.Checkbox,
Expand Down

0 comments on commit 4566b04

Please sign in to comment.