import { makeAppObjectRepo } from "@vived/core";
import { UndoRedoEntity } from "../Entities/UndoRedoEntity";
import { doUndo } from "./doUndo";
class MockMockUndoRedo extends UndoRedoEntity {
    constructor() {
        super(...arguments);
        this.submitAction = jest.fn();
        this.doUndo = jest.fn();
        this.doRedo = jest.fn();
        this.clearStack = jest.fn();
    }
    get hasUndo() {
        throw new Error("Method not implemented.");
    }
    get hasRedo() {
        throw new Error("Method not implemented.");
    }
}
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const app = appObjects.getOrCreate("App");
    const mockUndo = new MockMockUndoRedo(app, UndoRedoEntity.type);
    return { mockUndo, appObjects };
}
describe("Do Undo Controller", () => {
    it("Triggers the UC", () => {
        const { appObjects, mockUndo } = makeTestRig();
        doUndo(appObjects);
        expect(mockUndo.doUndo).toHaveBeenCalled();
    });
    it("Warns if it can't find the UC", () => {
        const { appObjects, mockUndo } = makeTestRig();
        appObjects.submitWarning = jest.fn();
        mockUndo.dispose();
        doUndo(appObjects);
        expect(appObjects.submitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=doUndo.test.js.map