"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const UndoRedoEntity_1 = require("../Entities/UndoRedoEntity");
const clearUndoStack_1 = require("./clearUndoStack");
class MockMockUndoRedo extends UndoRedoEntity_1.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 = (0, core_1.makeAppObjectRepo)();
    const app = appObjects.getOrCreate("App");
    const mockUndo = new MockMockUndoRedo(app, UndoRedoEntity_1.UndoRedoEntity.type);
    return { mockUndo, appObjects };
}
describe("Clear Undo Controller", () => {
    it("Triggers the UC", () => {
        const { appObjects, mockUndo } = makeTestRig();
        (0, clearUndoStack_1.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();
        (0, clearUndoStack_1.clearUndoStack)(appObjects);
        expect(appObjects.submitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=clearUndoStack.test.js.map