generated from CodelyTV/figma-plugin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCancelCommandHandler.test.ts
27 lines (20 loc) · 992 Bytes
/
CancelCommandHandler.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { mock } from "jest-mock-extended";
import { CancelCommand } from "../../src/scene-commands/cancel/CancelCommand";
import { CancelCommandHandler } from "../../src/scene-commands/cancel/CancelCommandHandler";
describe("CancelCommandHandler", () => {
it("can be instantiated without throwing errors", () => {
const figmaPluginApiMock = mock<PluginAPI>();
const cancelCommandHandlerInstantiator = () => {
new CancelCommandHandler(figmaPluginApiMock);
};
expect(cancelCommandHandlerInstantiator).not.toThrow(TypeError);
});
it("notifies the end used with a farewell message", () => {
const figmaPluginApiMock = mock<PluginAPI>();
const cancelCommandHandler = new CancelCommandHandler(figmaPluginApiMock);
const randomCancelCommand = new CancelCommand();
cancelCommandHandler.handle(randomCancelCommand);
const farewellMessage = "👋 Good bye!";
expect(figmaPluginApiMock.notify).toHaveBeenCalledWith(farewellMessage);
});
});