import { render, screen } from '@testing-library/react';
import MockAppWithProviders from "../../../../../mocks/AppWithProvider";
import RolePermissionComponent from "@/core/components/Middleware/RolePermissionComponent";

describe('RolePermissionComponent From RolePermissionComponent page', () => {
    describe('Rendering', () => {
        it('should render the error message when user dont have permission', () => {
            render(<MockAppWithProviders><RolePermissionComponent /></MockAppWithProviders>);

            expect(screen.queryByText('شما دسترسی لازم برای مشاهده این صفحه را ندارید!')).toBeInTheDocument();

        });

        it('should render the back dashboard button when user dont have permission', () => {
            render(<MockAppWithProviders><RolePermissionComponent /></MockAppWithProviders>);

            const backButton = screen.queryByText('بازگشت به صفحه اصلی');

            expect(backButton).toBeInTheDocument();

        });
    });
});
