import {fireEvent, queryByText, render, screen, waitFor} from "@testing-library/react";
import CreateForm from "@/components/dashboard/role-management/Form/CreateForm";
import MockAppWithProviders from "../../../../../../../mocks/AppWithProvider";

describe("Create Form Component from Role Management Component",()=>{
    describe("Rendering",()=>{

        it('should see Dialog text',  async () => {
            render(
                <MockAppWithProviders>
                    <CreateForm />
                </MockAppWithProviders>
            )
            const textElement = screen.queryByText("افزودن")
            await waitFor(()=>{
                expect(textElement).toBeInTheDocument()
            })
        });

        it('should see Tooltip text when mouse over',  async () => {
            render(
                <MockAppWithProviders>
                    <CreateForm />
                </MockAppWithProviders>
            )
            const buttonElement = screen.getByText("افزودن");
            fireEvent.mouseOver(buttonElement);
            const tooltipTextElement = screen.getByText("افزودن");
            await waitFor(()=>{
                expect(tooltipTextElement).toBeInTheDocument()
            })
        });
    })
})