import React from "react";
import { vi } from "vitest";
import { render } from "@testing-library/react";
import { Description } from "./index";
vi.mock("react-i18next", () => ({
    useTranslation: () => ({
        t: (key) => key,
    }),
}));
const { useRootElementMock } = vi.hoisted(() => ({
    useRootElementMock: vi.fn(),
}));
vi.mock("../context", () => ({
    useRootElement: useRootElementMock,
}));
describe("Description", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("renders the children when provided", () => {
        useRootElementMock.mockReturnValue({ isLoading: false });
        const { getByTestId } = render(React.createElement(Description, null, "Test Description"));
        expect(getByTestId("description")).toHaveTextContent("Test Description");
    });
    it("renders the noData translation when children is not provided", () => {
        useRootElementMock.mockReturnValue({ isLoading: false });
        const { getByTestId } = render(React.createElement(Description, null));
        expect(getByTestId("description")).toHaveTextContent("noData");
    });
    it("does not render description content when isLoading is true", () => {
        useRootElementMock.mockReturnValue({ isLoading: true });
        const { getByTestId } = render(React.createElement(Description, null, "Test Description"));
        expect(getByTestId("description")).toBeEmptyDOMElement();
    });
});
//# sourceMappingURL=index.test.js.map