"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const BaseAppState_1 = require("../../BaseApp/Entity/BaseAppState");
const Selection_1 = require("../Entities/Selection");
const ClearSelectionUCHook_1 = require("./ClearSelectionUCHook");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const baseApp = (0, BaseAppState_1.makeBaseAppState)(appObjects.getOrCreate("BaseApp"));
    const selection = (0, Selection_1.makeSelection)(appObjects.getOrCreate("Selection"));
    baseApp.isAuthoring = false;
    new ClearSelectionUCHook_1.ClearSelectionUCHook(appObjects.getOrCreate("UC"));
    return { appObjects, baseApp, selection };
}
describe("Clear Selection UC Hook", () => {
    it("Clear the pressed object when the is authoring flag changes", () => {
        const { baseApp, selection } = makeTestRig();
        const spy = jest.spyOn(selection, "pressedObjectId", "set");
        baseApp.isAuthoring = true;
        expect(spy).toHaveBeenCalledWith(null);
        spy.mockClear();
        baseApp.isAuthoring = false;
        expect(spy).toHaveBeenCalledWith(null);
        spy.mockClear();
        baseApp.notifyOnChange();
        expect(spy).not.toHaveBeenCalled();
    });
    it("Clear the hovered object when the is authoring flag changes", () => {
        const { baseApp, selection } = makeTestRig();
        const spy = jest.spyOn(selection, "hoveredObjectId", "set");
        baseApp.isAuthoring = true;
        expect(spy).toHaveBeenCalledWith(null);
        spy.mockClear();
        baseApp.isAuthoring = false;
        expect(spy).toHaveBeenCalledWith(null);
        spy.mockClear();
        baseApp.notifyOnChange();
        expect(spy).not.toHaveBeenCalled();
    });
    it("Clear the selected object when the is authoring flag changes", () => {
        const { baseApp, selection } = makeTestRig();
        const spy = jest.spyOn(selection, "selectedObjectId", "set");
        baseApp.isAuthoring = true;
        expect(spy).toHaveBeenCalledWith(null);
        spy.mockClear();
        baseApp.isAuthoring = false;
        expect(spy).toHaveBeenCalledWith(null);
        spy.mockClear();
        baseApp.notifyOnChange();
        expect(spy).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=ClearSelectionUCHook.test.js.map