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