"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const SetCustomLabelUC_1 = require("../UC/SetCustomLabelUC");
const updateCustomLabel_1 = require("./updateCustomLabel");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    const ao = appObjects.getOrCreate("App Object ID");
    const clearCustomLabelUC = new SetCustomLabelUC_1.SetCustomLabelUC(ao);
    const mockUpdateCustomLabel = jest.fn();
    clearCustomLabelUC.update = mockUpdateCustomLabel;
    return {
        appObjects,
        ao,
        mockSubmitWarning,
        mockUpdateCustomLabel,
    };
}
describe("Update Custom Label Controller", () => {
    it("Calls Set Custom Label method", () => {
        const { appObjects, ao, mockUpdateCustomLabel } = makeTestRig();
        (0, updateCustomLabel_1.updateCustomLabel)("custom", ao.id, appObjects);
        expect(mockUpdateCustomLabel).toHaveBeenCalled();
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        (0, updateCustomLabel_1.updateCustomLabel)("custom", "TEST AO", appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
    it("Submits warning if SetCustomLabel UC was not added", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        const ao = appObjects.getOrCreate("TEST AO");
        (0, updateCustomLabel_1.updateCustomLabel)("custom", ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=updateCustomLabel.test.js.map