import {render, screen, waitFor} from "@testing-library/react";
import MockAppWithProviders from "../../../../../../mocks/AppWithProvider";
import SidebarDrawer from "@/components/layouts/Dashboard/Sidebar/SidebarDrawer";

describe('SidebarDrawer', () => {
    describe('Rendering', () => {
        it('renders system name in sidebar', async () => {
            render(<MockAppWithProviders><SidebarDrawer/></MockAppWithProviders>);
            await waitFor(()=>{
                const systemName = screen.getByRole('heading', { level: 6 });
                expect(systemName).toHaveTextContent('سامانه CRM');
            })
        });
        it('renders user full name and position in sidebar', async () => {
            localStorage.setItem("_token", 'token');
            render(<MockAppWithProviders><SidebarDrawer/></MockAppWithProviders>);
            await waitFor(()=>{
                const userName = screen.queryByText(/Witel Company | Software Engineer/i);
                expect(userName).toBeInTheDocument();
            })
        });
    })
})
