import { makeAppObjectRepo } from "@vived/core";
import { UndoRedoEntity } from "../Entities/UndoRedoEntity";
import { clearUndoStack } from "./clearUndoStack";
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("Clear Undo Controller", () => {
    it("Triggers the UC", () => {
        const { appObjects, mockUndo } = makeTestRig();
        clearUndoStack(appObjects);
        expect(mockUndo.clearStack).toHaveBeenCalled();
    });
    it("Warns if it can't find the UC", () => {
        const { appObjects, mockUndo } = makeTestRig();
        appObjects.submitWarning = jest.fn();
        mockUndo.dispose();
        clearUndoStack(appObjects);
        expect(appObjects.submitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=clearUndoStack.test.js.map