"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Entities_1 = require("../Entities");
const SetOverlayColorUC_1 = require("../UC/SetOverlayColorUC");
const SetOverlayColor_1 = require("./SetOverlayColor");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    const ao = appObjects.getOrCreate("App Object ID");
    const setOverlayColorUC = new SetOverlayColorUC_1.SetOverlayColorUC(ao);
    const mockSetOverlayColor = jest.fn();
    setOverlayColorUC.setOverlayColor = mockSetOverlayColor;
    return {
        appObjects,
        ao,
        mockSubmitWarning,
        mockSetOverlayColor,
    };
}
describe("Set Overlay Color Controller", () => {
    it("Calls Set Overlay Color method", () => {
        const { appObjects, ao, mockSetOverlayColor } = makeTestRig();
        (0, SetOverlayColor_1.setOverlayColor)(Entities_1.OverlayColorEnums.WHITE, ao.id, appObjects);
        expect(mockSetOverlayColor).toHaveBeenCalledWith(Entities_1.OverlayColorEnums.WHITE);
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        (0, SetOverlayColor_1.setOverlayColor)(Entities_1.OverlayColorEnums.WHITE, "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, SetOverlayColor_1.setOverlayColor)(Entities_1.OverlayColorEnums.WHITE, ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=SetOverlayColor.test.js.map