import { makeAppObjectRepo } from "@vived/core";
import { SetCustomLabelUC } from "../UC/SetCustomLabelUC";
import { setCustomLabel } from "./SetCustomLabel";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    const ao = appObjects.getOrCreate("App Object ID");
    const setCustomLabelUC = new SetCustomLabelUC(ao);
    const mockSetCustomLabel = jest.fn();
    setCustomLabelUC.setCustomLabel = mockSetCustomLabel;
    return {
        appObjects,
        ao,
        mockSubmitWarning,
        mockSetCustomLabel,
    };
}
describe("Set Custom Label Controller", () => {
    it("Calls Set Custom Label method", () => {
        const { appObjects, ao, mockSetCustomLabel } = makeTestRig();
        setCustomLabel("custom", ao.id, appObjects);
        expect(mockSetCustomLabel).toHaveBeenCalledWith("custom");
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        setCustomLabel("custom", "TEST AO", appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
    it("Submits warning if ClearCustomLabel UC was added", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        const ao = appObjects.getOrCreate("TEST AO");
        setCustomLabel("custom", ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=SetCustomLabel.test.js.map