"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const MockDispatchStateChange_1 = require("../../Dispatcher/Mocks/MockDispatchStateChange");
const Hideable_1 = require("../../Hideable/Entities/Hideable");
const MockUndoRedo_1 = require("../../UndoRedo/Mocks/MockUndoRedo");
const UnhideAllAppObjectsUndoRedo_1 = require("./UnhideAllAppObjectsUndoRedo");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const ao = appObjects.getOrCreate("App");
    const mockDispatchStateChange = (0, MockDispatchStateChange_1.makeMockDispatchStateChange)(appObjects);
    const doDispatchMock = jest.fn();
    mockDispatchStateChange.doDispatch = doDispatchMock;
    const sm1 = appObjects.getOrCreate("sm1");
    const sm2 = appObjects.getOrCreate("sm2");
    const sm1Hideable = new Hideable_1.Hideable(sm1);
    const sm2Hideable = new Hideable_1.Hideable(sm2);
    const hiddenObjects = ["sm1", "sm2"];
    (0, MockUndoRedo_1.makeMockUndoRedo)(appObjects);
    return {
        appObjects,
        sm1Hideable,
        sm2Hideable,
        doDispatchMock,
        hiddenObjects,
    };
}
describe("UnhideAllAppObjectsUndoRedo", () => {
    it("Undo hide App Object action", () => {
        const { appObjects, sm1Hideable, sm2Hideable, doDispatchMock, hiddenObjects, } = makeTestRig();
        doDispatchMock.mockClear();
        const action = new UnhideAllAppObjectsUndoRedo_1.UnhideAllAppObjectsUndoRedo(hiddenObjects, appObjects);
        action.undoAction();
        expect(sm1Hideable.isHidden).toEqual(true);
        expect(sm2Hideable.isHidden).toEqual(true);
        expect(doDispatchMock).toHaveBeenCalled();
    });
    it("Redo hide App Object action", () => {
        const { appObjects, hiddenObjects, sm1Hideable, sm2Hideable, doDispatchMock, } = makeTestRig();
        const action = new UnhideAllAppObjectsUndoRedo_1.UnhideAllAppObjectsUndoRedo(hiddenObjects, appObjects);
        action.undoAction();
        doDispatchMock.mockClear();
        action.redoAction();
        expect(sm1Hideable.isHidden).toEqual(false);
        expect(sm2Hideable.isHidden).toEqual(false);
        expect(doDispatchMock).toHaveBeenCalled();
    });
});
//# sourceMappingURL=UnhideAllAppObjectsUndoRedo.test.js.map