"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const BaseAppState_1 = require("../../BaseApp/Entity/BaseAppState");
const LabelDropRepo_1 = require("../Entities/LabelDropRepo");
const ClearEditingLabelDropUCHook_1 = require("./ClearEditingLabelDropUCHook");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const baseApp = (0, BaseAppState_1.makeBaseAppState)(appObjects.getOrCreate("BaseApp"));
    const labelDropRepo = (0, LabelDropRepo_1.makeLabelDropRepo)(appObjects.getOrCreate("LabelDrop"));
    labelDropRepo.makeLabelDropItem("SomeID");
    new ClearEditingLabelDropUCHook_1.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