"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const SetCustomLabelUC_1 = require("../UC/SetCustomLabelUC");
const submitCustomLabel_1 = require("./submitCustomLabel");
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 mockSubmitCustomLabel = jest.fn();
    clearCustomLabelUC.submit = mockSubmitCustomLabel;
    return {
        appObjects,
        ao,
        mockSubmitWarning,
        mockSubmitCustomLabel,
    };
}
describe("Submit Custom Label Controller", () => {
    it("Calls Submit Custom Label method", () => {
        const { appObjects, ao, mockSubmitCustomLabel } = makeTestRig();
        (0, submitCustomLabel_1.submitCustomLabel)(ao.id, appObjects);
        expect(mockSubmitCustomLabel).toHaveBeenCalled();
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        (0, submitCustomLabel_1.submitCustomLabel)("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, submitCustomLabel_1.submitCustomLabel)(ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=submitCustomLabel.test.js.map