import { makeAppObjectRepo } from "@vived/core";
import { makeMockDispatchStateChange } from "../../Dispatcher/Mocks/MockDispatchStateChange";
import { Hideable } from "../../Hideable/Entities/Hideable";
import { makeMockUndoRedo } from "../../UndoRedo/Mocks/MockUndoRedo";
import { UnhideAllAppObjectsUndoRedo } from "./UnhideAllAppObjectsUndoRedo";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("App");
    const mockDispatchStateChange = makeMockDispatchStateChange(appObjects);
    const sm1 = appObjects.getOrCreate("sm1");
    const sm2 = appObjects.getOrCreate("sm2");
    const sm1Hideable = new Hideable(sm1);
    const sm2Hideable = new Hideable(sm2);
    const hiddenObjects = ["sm1", "sm2"];
    makeMockUndoRedo(appObjects);
    return {
        appObjects,
        sm1Hideable,
        sm2Hideable,
        mockDispatchStateChange,
        hiddenObjects,
    };
}
describe("UnhideAllAppObjectsUndoRedo", () => {
    it("Undo hide App Object action", () => {
        const { appObjects, sm1Hideable, sm2Hideable, mockDispatchStateChange, hiddenObjects, } = makeTestRig();
        mockDispatchStateChange.doDispatch.mockClear();
        const action = new UnhideAllAppObjectsUndoRedo(hiddenObjects, appObjects);
        action.undoAction();
        expect(sm1Hideable.isHidden).toEqual(true);
        expect(sm2Hideable.isHidden).toEqual(true);
        expect(mockDispatchStateChange.doDispatch).toHaveBeenCalled();
    });
    it("Redo hide App Object action", () => {
        const { appObjects, hiddenObjects, sm1Hideable, sm2Hideable, mockDispatchStateChange, } = makeTestRig();
        const action = new UnhideAllAppObjectsUndoRedo(hiddenObjects, appObjects);
        action.undoAction();
        mockDispatchStateChange.doDispatch.mockClear();
        action.redoAction();
        expect(sm1Hideable.isHidden).toEqual(false);
        expect(sm2Hideable.isHidden).toEqual(false);
        expect(mockDispatchStateChange.doDispatch).toHaveBeenCalled();
    });
});
//# sourceMappingURL=UnhideAllAppObjectsUndoRedo.test.js.map