import {render, screen, waitFor} from "@testing-library/react";
import MockAppWithProviders from "../../../../../../../../../../../mocks/AppWithProvider";
import {AnswersProvider} from "@/lib/callWidget/contexts/answers";
import ActionHeader from "..";

const tab = {
    active: true,
    active_category_id: 1,
    phone_number : "09134849737"
}

describe('Action Header Button from Call Actions Categories', () => {
    describe('Rendering', () => {
        it('should see header text', async () => {
            render(
                <MockAppWithProviders>
                    <AnswersProvider>
                        <ActionHeader tab={tab} />
                    </AnswersProvider>
                </MockAppWithProviders>
            )
            const headingElement = screen.getByRole('heading', {
                name: /\.\.\.\. عملیات های مربوط به تماس:/i
              })
            await waitFor(() => {
                expect(headingElement).toBeInTheDocument()
            })
        });
        it('should see phone number', async () => {
            render(
                <MockAppWithProviders>
                    <AnswersProvider>
                        <ActionHeader tab={tab} />
                    </AnswersProvider>
                </MockAppWithProviders>
            )
            const phone_numberElement = screen.queryByText(/09134849737/i)
            await waitFor(() => {
                expect(phone_numberElement).toBeInTheDocument()
            })
        });
    });
});