import { makeAppObjectRepo } from "@vived/core";
import { makeBaseAppState } from "../../BaseApp/Entity/BaseAppState";
import { makeLabelDropRepo } from "../Entities/LabelDropRepo";
import { ClearEditingLabelDropUCHook } from "./ClearEditingLabelDropUCHook";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const baseApp = makeBaseAppState(appObjects.getOrCreate("BaseApp"));
    const labelDropRepo = makeLabelDropRepo(appObjects.getOrCreate("LabelDrop"));
    labelDropRepo.makeLabelDropItem("SomeID");
    new ClearEditingLabelDropUCHook(appObjects.getOrCreate("UC"));
    return { appObjects, baseApp, labelDropRepo };
}
describe("Clear Editing Label Drop UC Hook", () => {
    it("Clear the editing ID when we switch back to consumption", () => {
        const { baseApp, labelDropRepo } = makeTestRig();
        baseApp.isAuthoring = true;
        labelDropRepo.editingID = "SomeID";
        expect(labelDropRepo.editingID).toEqual("SomeID");
        baseApp.isAuthoring = false;
        expect(labelDropRepo.editingID).toBeUndefined();
    });
    it("Does not clear not flipping back to consumption", () => {
        const { baseApp, labelDropRepo } = makeTestRig();
        baseApp.isAuthoring = true;
        labelDropRepo.editingID = "SomeID";
        expect(labelDropRepo.editingID).toEqual("SomeID");
        baseApp.notifyOnChange();
        expect(labelDropRepo.editingID).toEqual("SomeID");
    });
});
//# sourceMappingURL=ClearEditingLabelDropUCHook.test.js.map