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

const sub_category = {
    category_id: 1,
    category_name: "اطلاعات راه",
    subcategory_id: 1,
    subcategory_name: "اطلاعات باز و بسته"
};

const tab = {
    active: true,
    active_category_id: 1,
    date: new Date(),
    id: 1,
    phone_number: "09134849737"
};

describe('Call Action Subcategories Button from Call Actions Categories', () => {
    describe('Rendering', () => {
        it('should render subcategory name', async () => {
            render(
                <MockAppWithProviders>
                    <AnswersProvider>
                        <CallActionSubcategoriesButton sub_category={sub_category} tab={tab} />
                    </AnswersProvider>
                </MockAppWithProviders>
            );
            const subCategoryElement = screen.queryByText(/اطلاعات باز و بسته/i);
            await waitFor(() => {
                expect(subCategoryElement).toBeInTheDocument();
            });
        });
    });
});