"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const SetCustomLabelUC_1 = require("../UC/SetCustomLabelUC");
const SetCustomLabel_1 = require("./SetCustomLabel");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    const ao = appObjects.getOrCreate("App Object ID");
    const setCustomLabelUC = new SetCustomLabelUC_1.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();
        (0, SetCustomLabel_1.setCustomLabel)("custom", ao.id, appObjects);
        expect(mockSetCustomLabel).toHaveBeenCalledWith("custom");
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        (0, SetCustomLabel_1.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");
        (0, SetCustomLabel_1.setCustomLabel)("custom", ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=SetCustomLabel.test.js.map