CFE-3 complete behavioral and rendering tests for CreateForm Component and start CreateContent testing component
This commit is contained in:
@@ -32,7 +32,8 @@
|
||||
"dashboard": "داشبورد",
|
||||
"change-password": "تغییر رمز عبور",
|
||||
"edit-profile": "ویرایش پروفایل",
|
||||
"admin": "مدیریت"
|
||||
"admin": "مدیریت",
|
||||
"expert-management": "مدیریت کارشناسان"
|
||||
},
|
||||
"secondary": {
|
||||
},
|
||||
@@ -70,7 +71,8 @@
|
||||
"Dashboard": {
|
||||
"dashboard_page": "داشبورد",
|
||||
"change_password": "تغییر رمز عبور",
|
||||
"edit_profile": "ویرایش پروفایل"
|
||||
"edit_profile": "ویرایش پروفایل",
|
||||
"expert_management": "داشبورد"
|
||||
},
|
||||
"MuiDatePicker": {
|
||||
"date_picker_birthday": "تاریخ"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import {fireEvent, render, screen} from "@testing-library/react";
|
||||
import React, {useState} from 'react';
|
||||
import {act, fireEvent, render, screen} from "@testing-library/react";
|
||||
import React from 'react';
|
||||
import MockAppWithProviders from "../../../../../../../mocks/AppWithProvider";
|
||||
import CreateForm from "../../CreateForm";
|
||||
|
||||
jest.spyOn(React, 'useState');
|
||||
|
||||
describe("CreateForm Component From Expert Management", () => {
|
||||
describe("Rendering", () => {
|
||||
it("Create Button Rendered", () => {
|
||||
@@ -19,13 +17,14 @@ describe("CreateForm Component From Expert Management", () => {
|
||||
});
|
||||
});
|
||||
describe("Behavioral", () => {
|
||||
it("by Clicking Create Button Dialog State Should Change (true/false)", () => {
|
||||
const setOpenCreateDialogMock = jest.fn();
|
||||
useState.mockReturnValue([false, setOpenCreateDialogMock]);
|
||||
it("by Clicking Create Button Dialog Should Append To Document", async () => {
|
||||
render(<MockAppWithProviders><CreateForm/></MockAppWithProviders>);
|
||||
const CreateButton = screen.getByRole('button', {name: "افزودن کارشناس"});
|
||||
fireEvent.click(CreateButton);
|
||||
expect(setOpenCreateDialogMock).toHaveBeenCalledWith(true);
|
||||
await act(() => {
|
||||
const CreateDialog = screen.getByRole('dialog', {name: "افزودن کارشناس"})
|
||||
expect(CreateDialog).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
||||
import DashboardLayouts from "@/layouts/DashboardLayout";
|
||||
import ExpertManagementDataTable from "@/components/dashboard/expert-management/DataTable";
|
||||
|
||||
function DashboardExpertManagementComponent() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SpaceDashboardIcon from "@mui/icons-material/SpaceDashboard";
|
||||
import ManageAccountsIcon from '@mui/icons-material/ManageAccounts';
|
||||
|
||||
const sidebarMenu = [
|
||||
[
|
||||
@@ -6,7 +7,16 @@ const sidebarMenu = [
|
||||
key: "sidebar.dashboard",
|
||||
type: "page",
|
||||
route: "/dashboard",
|
||||
icon: <SpaceDashboardIcon />,
|
||||
icon: <SpaceDashboardIcon/>,
|
||||
selected: false,
|
||||
permission: "all",
|
||||
},
|
||||
{
|
||||
key: "sidebar.expert-management",
|
||||
type: "page",
|
||||
name: "expert_management",
|
||||
route: "/dashboard/expert-management",
|
||||
icon: <ManageAccountsIcon/>,
|
||||
selected: false,
|
||||
permission: "all",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user