CFE-3 complete behavioral and rendering tests for CreateForm Component and start CreateContent testing component
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user