test(action): add simple focus up action unit test

This is just a basic unit test.
This commit is contained in:
Mikhail Zolotukhin 2021-09-21 21:04:44 +03:00
parent 5416912efd
commit 32ae23c6a2

View File

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin <mail@genda.life>
//
// 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<Engine>({ 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");
});
});
});