diff --git a/src/controller/action.test.ts b/src/controller/action.test.ts new file mode 100644 index 00000000..c2b92922 --- /dev/null +++ b/src/controller/action.test.ts @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin +// +// SPDX-License-Identifier: MIT + +import { createMock } from "ts-auto-mock"; +import { Engine } from "../engine"; +import { FocusUpperWindow } from "./action"; + +describe("action", () => { + describe("focus up", () => { + const fakeEngine = createMock({ focusDir: jest.fn() }); + const action = new FocusUpperWindow(fakeEngine); + it("correctly executes", () => { + // Arrange + jest.spyOn(fakeEngine, "focusDir"); + + // Act + action.execute(); + + // Assert + // eslint-disable-next-line @typescript-eslint/unbound-method + expect(fakeEngine.focusDir).toBeCalledWith("up"); + }); + }); +});