CFE-6 debug test problem refer expert management components

This commit is contained in:
2023-10-31 15:39:22 +03:30
parent b9a6eae167
commit 23ff9fd7da
2 changed files with 8 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ describe("ExpertManagementDatatable Component From Expert Management", () => {
const nameHeader = screen.queryByText("نام کامل");
const usernameHeader = screen.queryByText("نام کاربری");
const emailHeader = screen.queryByText("پست الکترونیک");
const telephone_idHeader = screen.queryByText("کد تلفن");
const phone_numberHeader = screen.queryByText("شماره همراه");
const national_idHeader = screen.queryByText("کد ملی");
const positionHeader = screen.queryByText("سمت");
@@ -21,6 +22,7 @@ describe("ExpertManagementDatatable Component From Expert Management", () => {
expect(nameHeader).toBeInTheDocument();
expect(usernameHeader).toBeInTheDocument();
expect(emailHeader).toBeInTheDocument();
expect(telephone_idHeader).toBeInTheDocument();
expect(phone_numberHeader).toBeInTheDocument();
expect(national_idHeader).toBeInTheDocument();
expect(positionHeader).toBeInTheDocument();

View File

@@ -18,22 +18,22 @@ describe("CreateForm Component From Expert Management", () => {
describe("Rendering", () => {
it("Create Button Rendered", () => {
render(<MockAppWithProviders><CreateForm/></MockAppWithProviders>);
const CreateButton = screen.getByRole('button', {name: "افزودن کارشناس"});
const CreateButton = screen.getByRole('button', {name: "افزودن"});
expect(CreateButton).toBeInTheDocument();
});
it("Dialog Header Rendered", () => {
render(<MockAppWithProviders><CreateForm/></MockAppWithProviders>);
const CreateDialogHeader = screen.queryByText("افزودن کارشناس");
const CreateDialogHeader = screen.queryByText("افزودن");
expect(CreateDialogHeader).toBeInTheDocument();
});
});
describe("Behavioral", () => {
it("by Clicking Create Button Dialog Should Append To Document", async () => {
render(<MockAppWithProviders><CreateForm/></MockAppWithProviders>);
const CreateButton = screen.getByRole('button', {name: "افزودن کارشناس"});
const CreateButton = screen.getByRole('button', {name: "افزودن"});
fireEvent.click(CreateButton);
await act(() => {
const CreateDialog = screen.getByRole('dialog', {name: "افزودن کارشناس"})
const CreateDialog = screen.getByRole('dialog', {name: "افزودن"})
expect(CreateDialog).toBeInTheDocument();
});
});
@@ -42,7 +42,7 @@ describe("CreateForm Component From Expert Management", () => {
it('Should request to api and if get success close dialog', async () => {
render(<MockAppWithProviders><CreateForm/></MockAppWithProviders>);
const CreateButton = screen.getByRole('button', {name: "افزودن کارشناس"});
const CreateButton = screen.getByRole('button', {name: "افزودن"});
fireEvent.click(CreateButton);
const submitButton = screen.queryByText('ثبت');
@@ -80,7 +80,7 @@ describe("CreateForm Component From Expert Management", () => {
it('Should request to api and if get error keep previous data', async () => {
render(<MockAppWithProviders><CreateForm/></MockAppWithProviders>);
const CreateButton = screen.getByRole('button', {name: "افزودن کارشناس"});
const CreateButton = screen.getByRole('button', {name: "افزودن"});
fireEvent.click(CreateButton);
const submitButton = screen.queryByText('ثبت');