Skip to content

Commit

Permalink
fix: Update 'Name' field from mandatory to optional in Create User Mo…
Browse files Browse the repository at this point in the history
…dal (#4451)

* fix: Update 'Name' field from mandatory to optional in Create User Modal

Signed-off-by: ChaitanyaD48 <chaitanya.d48@gmail.com>

* Remove form field validation test in CreateNewUserView

Signed-off-by: ChaitanyaD48 <chaitanya.d48@gmail.com>

* Refactor: Remove unused import

Signed-off-by: ChaitanyaD48 <chaitanya.d48@gmail.com>

---------

Signed-off-by: ChaitanyaD48 <chaitanya.d48@gmail.com>
Co-authored-by: Namkyu Park <53862866+namkyu1999@users.noreply.github.com>
Co-authored-by: Saranya Jena <saranya.jena@harness.io>
Co-authored-by: Sarthak Jain <sarthak.jain@harness.io>
  • Loading branch information
4 people authored Mar 8, 2024
1 parent f05556a commit 4c13f7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function CreateNewUserView(props: CreateNewUserViewProps): React.
}}
onSubmit={values => handleSubmit(values)}
validationSchema={Yup.object().shape({
name: Yup.string().required(getString('nameIsARequiredField')),
name: Yup.string(),
email: Yup.string().email(getString('invalidEmailText')).required(getString('emailIsRequired')),
username: Yup.string().required(getString('usernameIsRequired')),
password: Yup.string().required(getString('passwordIsRequired')),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
import { render, fireEvent } from '@testing-library/react';
import { TestWrapper } from 'utils/testUtils';
import CreateNewUserView from '../CreateNewUser';
import '@testing-library/jest-dom';
Expand All @@ -24,15 +24,6 @@ describe('<CreateNewUserView />', () => {
expect(getByText('createNewUser')).toBeInTheDocument();
});

test('validates form fields', async () => {
const { getByText, getByPlaceholderText } = setup();
fireEvent.change(getByPlaceholderText('enterYourName'), { target: { value: '' } });
fireEvent.submit(getByText('confirm'));
await waitFor(() => {
expect(getByText('nameIsARequiredField')).toBeInTheDocument();
});
});

test('calls handleClose on cancel', () => {
const { getByText } = setup();
fireEvent.click(getByText('cancel'));
Expand Down

0 comments on commit 4c13f7d

Please sign in to comment.