diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/PersonalInfo/__tests__/index.test.js b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/PersonalInfo/__tests__/index.test.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/PersonalInfo/index.jsx b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/PersonalInfo/index.jsx
new file mode 100644
index 0000000..9254771
--- /dev/null
+++ b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/PersonalInfo/index.jsx
@@ -0,0 +1,73 @@
+import {Grid, TextField} from "@mui/material";
+import {useTranslations} from "next-intl";
+
+const PersonalInfo = ({formik}) => {
+ const t = useTranslations();
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default PersonalInfo
\ No newline at end of file
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/RestInfo/__tests__/index.test.js b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/RestInfo/__tests__/index.test.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/RestInfo/index.jsx b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/RestInfo/index.jsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/UserInfo/__test__/index.test.js b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/UserInfo/__test__/index.test.js
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/UserInfo/index.jsx b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/UserInfo/index.jsx
new file mode 100644
index 0000000..189f997
--- /dev/null
+++ b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/UserInfo/index.jsx
@@ -0,0 +1,54 @@
+import {Grid, IconButton, InputAdornment, TextField} from "@mui/material";
+import {useTranslations} from "next-intl";
+import {Visibility, VisibilityOff} from "@mui/icons-material";
+
+const UserInfo = ({formik}) => {
+ const t = useTranslations();
+ return (
+ <>
+
+
+
+
+
+
+
+ {showPassword ? : }
+
+
+ ),
+ }}
+ sx={{width: "100%"}}
+ />
+
+
+ >
+ )
+}
+export default UserInfo
\ No newline at end of file
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/__tests__/index.test.js b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/__tests__/index.test.js
index cf93005..fee508f 100644
--- a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/__tests__/index.test.js
+++ b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/__tests__/index.test.js
@@ -1,4 +1,4 @@
-import {act, render, screen, waitFor} from "@testing-library/react";
+import {act, fireEvent, render, screen, waitFor} from "@testing-library/react";
import React from 'react';
import CreateContent from "../../CreateContent";
import MockAppWithProviders from "../../../../../../../../mocks/AppWithProvider";
@@ -15,69 +15,142 @@ describe("CreateContent Component From Expert Management", () => {
it("UserName TextField Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.queryByLabelText('نام کاربری');
- expect(nameTextField).toBeInTheDocument();
+ const usernameTextField = screen.queryByLabelText('نام کاربری');
+ expect(usernameTextField).toBeInTheDocument();
});
});
it("Email TextField Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.queryByLabelText('پست الکترونیک');
- expect(nameTextField).toBeInTheDocument();
+ const emailTextField = screen.queryByLabelText('پست الکترونیک');
+ expect(emailTextField).toBeInTheDocument();
});
});
it("Phone Number TextField Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.queryByLabelText('شماره همراه');
- expect(nameTextField).toBeInTheDocument();
+ const phoneNumberTextField = screen.queryByLabelText('شماره همراه');
+ expect(phoneNumberTextField).toBeInTheDocument();
});
});
it("National Id TextField Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.queryByLabelText('کد ملی');
- expect(nameTextField).toBeInTheDocument();
+ const nationalIdTextField = screen.queryByLabelText('کد ملی');
+ expect(nationalIdTextField).toBeInTheDocument();
});
});
it("Password TextField Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.queryByLabelText('رمز عبور');
- expect(nameTextField).toBeInTheDocument();
+ const passwordTextField = screen.queryByLabelText('رمز عبور');
+ expect(passwordTextField).toBeInTheDocument();
});
});
it("Position TextField Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.queryByLabelText('سمت');
- expect(nameTextField).toBeInTheDocument();
+ const positionTextField = screen.queryByLabelText('سمت');
+ expect(positionTextField).toBeInTheDocument();
});
});
- it("Province TextField Rendered", async () => {
+ it("Province Select Box Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.getByTestId('province-select');
- expect(nameTextField).toBeInTheDocument();
+ const provinceSelectBox = screen.getByTestId('province-select');
+ expect(provinceSelectBox).toBeInTheDocument();
});
});
- it("City TextField Rendered", async () => {
+ it("City Select Box Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.getByTestId('city-select');
- expect(nameTextField).toBeInTheDocument();
+ const citySelectBox = screen.getByTestId('city-select');
+ expect(citySelectBox).toBeInTheDocument();
});
});
- it("Role TextField Rendered", async () => {
+ it("Role Select Box Rendered", async () => {
render();
await waitFor(() => {
- const nameTextField = screen.getByTestId('role-select');
- expect(nameTextField).toBeInTheDocument();
+ const roleSelectBox = screen.getByTestId('role-select');
+ expect(roleSelectBox).toBeInTheDocument();
});
});
});
describe("Behavioral", () => {
-
+ it("Name TextField Work Correctly", async () => {
+ render();
+ const nameTextField = screen.queryByLabelText('نام');
+ fireEvent.change(nameTextField, {target: {value: 'exampleName'}});
+ await act(() => {
+ expect(nameTextField).toHaveValue('exampleName');
+ })
+ });
+ it("Username TextField Work Correctly", async () => {
+ render();
+ const usernameTextField = screen.queryByLabelText('نام کاربری');
+ fireEvent.change(usernameTextField, {target: {value: 'exampleUsername'}});
+ await act(() => {
+ expect(usernameTextField).toHaveValue('exampleUsername');
+ })
+ });
+ it("Email TextField Work Correctly", async () => {
+ render();
+ const emailTextField = screen.queryByLabelText('پست الکترونیک');
+ fireEvent.change(emailTextField, {target: {value: 'exampleEmail'}});
+ await act(() => {
+ expect(emailTextField).toHaveValue('exampleEmail');
+ })
+ });
+ it("Phone Number TextField Work Correctly", async () => {
+ render();
+ const phoneNumberTextField = screen.queryByLabelText('شماره همراه');
+ fireEvent.change(phoneNumberTextField, {target: {value: 'examplePhoneNumber'}});
+ await act(() => {
+ expect(phoneNumberTextField).toHaveValue('examplePhoneNumber');
+ })
+ });
+ it("National Id TextField Work Correctly", async () => {
+ render();
+ const nationalIdTextField = screen.queryByLabelText('کد ملی');
+ fireEvent.change(nationalIdTextField, {target: {value: 'exampleNationalId'}});
+ await act(() => {
+ expect(nationalIdTextField).toHaveValue('exampleNationalId');
+ })
+ });
+ it("Password TextField Work Correctly", async () => {
+ render();
+ const passwordTextField = screen.queryByLabelText('رمز عبور');
+ fireEvent.change(passwordTextField, {target: {value: 'examplePassword'}});
+ await act(() => {
+ expect(passwordTextField).toHaveValue('examplePassword');
+ })
+ });
+ it("Position TextField Work Correctly", async () => {
+ render();
+ const positionTextField = screen.queryByLabelText('سمت');
+ fireEvent.change(positionTextField, {target: {value: 'examplePosition'}});
+ await act(() => {
+ expect(positionTextField).toHaveValue('examplePosition');
+ })
+ });
+ it("Province Select Box Work Correctly", async () => {
+ render();
+ screen.debug()
+ await waitFor(() => {
+ expect(screen.queryByText("آذربایجان شرقی")).toBeInTheDocument();
+ }, {timeout: 4000});
+ // const provinceSelectBox = screen.getByTestId('province-select');
+ // fireEvent.change(provinceSelectBox, {target: {value: 1}});
+ // expect(provinceSelectBox).toHaveValue(1);
+ });
+ // it("Role Select Box Work Correctly", async () => {
+ // render();
+ // const roleSelectBox = screen.getByTestId('role-select');
+ // fireEvent.change(roleSelectBox, {target: {value: '1'}});
+ // await act(() => {
+ // expect(roleSelectBox).toHaveValue('1');
+ // })
+ // });
});
});
\ No newline at end of file
diff --git a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/index.jsx b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/index.jsx
index 8f24ef4..ae6485d 100644
--- a/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/index.jsx
+++ b/src/components/dashboard/expert-management/Form/CreateForm/CreateContent/index.jsx
@@ -24,6 +24,8 @@ import {CREATE_EXPERT_MANAGEMENT, GET_CITY_LIST} from "@/core/data/apiRoutes";
import useRole from "@/lib/app/hooks/useRole";
import {Visibility, VisibilityOff} from "@mui/icons-material";
import useProvince from "@/lib/app/hooks/useProvince";
+import PersonalInfo from "@/components/dashboard/expert-management/Form/CreateForm/CreateContent/PersonalInfo";
+import UserInfo from "@/components/dashboard/expert-management/Form/CreateForm/CreateContent/UserInfo";
const CreateContent = ({setOpenCreateDialog, mutate, fetchUrl}) => {
const t = useTranslations();
@@ -123,68 +125,7 @@ const CreateContent = ({setOpenCreateDialog, mutate, fetchUrl}) => {
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
{
/>
-
-
-
-
-
-
-
- {showPassword ? : }
-
-
- ),
- }}
- sx={{width: "100%"}}
- />
-
-
+
{