import { makeAppObjectRepo } from "@vived/core";
import { SetCustomLabelUC } from "../UC/SetCustomLabelUC";
import { submitCustomLabel } from "./submitCustomLabel";
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 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();
        submitCustomLabel(ao.id, appObjects);
        expect(mockSubmitCustomLabel).toHaveBeenCalled();
    });
    it("Submits warning if App Object is not found", () => {
        const { appObjects, mockSubmitWarning } = makeTestRig();
        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");
        submitCustomLabel(ao.id, appObjects);
        expect(mockSubmitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=submitCustomLabel.test.js.map