import { makeAppObjectRepo } from "@vived/core";
import { SetCustomLabelUC } from "../UC/SetCustomLabelUC";
import { updateCustomLabel } from "./updateCustomLabel";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const mockSubmitWarning = jest.fn();
    appObjects.submitWarning = mockSubmitWarning;
    const ao = appObjects.getOrCreate("App Object ID");
    const clearCustomLabelUC = new 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();
        updateCustomLabel("custom", ao.id, appObjects);
        expect(mockUpdateCustomLabel).toHaveBeenCalled();
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        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");
        updateCustomLabel("custom", ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=updateCustomLabel.test.js.map