import { jsx as _jsx } from "@emotion/react/jsx-runtime";
import { act, renderHook } from "@testing-library/react-hooks";
import { RuntimeContext } from "./RuntimeContext";
import { useInputVariables, RuntimeInputContext } from "./RuntimeInput";
// @ts-ignore
import TextInput from "@qorebase/text-input-component";
import { initialPage } from "./InitialData";
describe("RuntimeInput", () => {
    it("should be able to extract the inputs as suggestions", () => {
        const homepage = initialPage;
        const componentInstance = {
            id: "some_text_input",
            componentID: "Text Input",
            options: {},
            properties: TextInput.component.defaultProps,
            showCondition: { type: "all", conditions: [] },
            source: {
                type: "record",
                rowId: null,
                params: {},
                defaultRow: { type: "first-row" },
            },
            metadata: {},
        };
        const wrapper = ({ children }) => (_jsx(RuntimeContext.Provider, { children: _jsx(RuntimeInputContext.Provider, { children: children }) }));
        const { result } = renderHook(() => ({
            suggestions: useInputVariables(),
            runtimeActions: RuntimeContext.useActions(),
        }), {
            wrapper,
        });
        act(() => {
            result.current.runtimeActions.addPage(homepage);
            result.current.runtimeActions.addComponent(componentInstance, {
                page: homepage.id,
            });
        });
        expect(result.current.suggestions).toEqual([
            { display: "input.Input", id: "input.Input" },
        ]);
    });
});
//# sourceMappingURL=RuntimeInput.spec.js.map