From 32ae23c6a2340db96eeeba0d1d289d4843423975 Mon Sep 17 00:00:00 2001 From: Mikhail Zolotukhin Date: Tue, 21 Sep 2021 21:04:44 +0300 Subject: [PATCH] test(action): :white_check_mark: add simple focus up action unit test This is just a basic unit test. --- src/controller/action.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/controller/action.test.ts 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"); + }); + }); +});