import {render, screen} from "@testing-library/react";
import FirstComponent from "@/components/first";
import MockAppWithProviders from "../../../../mocks/AppWithProvider";

describe("First Page Component", () => {
    describe("Rendering", () => {
        it("App Name Text Rendered", () => {
            render(<MockAppWithProviders><FirstComponent/></MockAppWithProviders>);
            const appNameElement = screen.queryByText(/سامانه CRM/i);
            expect(appNameElement).toBeInTheDocument()
        })
    });
    describe("Behavioral", () => {
        it("Show Login Button And Do Not Show Dashboard Button When User Is Not Authenticated", async () => {
            render(<MockAppWithProviders><FirstComponent/></MockAppWithProviders>);
            const authenticationButtonLogin = await screen.queryByText(/ورود کارشناس/i)
            const authenticationButtonDashboard = await screen.queryByText(/داشبورد/i)
            expect(authenticationButtonLogin).toBeInTheDocument()
            expect(authenticationButtonDashboard).not.toBeInTheDocument()
        })
    });
});