blob: a8e82df9cab9d4e4e4b39283f8ac46535ac8313c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import CommandParser, {
UnknownCommandError,
} from "../../../src/console/commandline/CommandParser";
import { Command } from "../../../src/shared/Command";
describe("CommandParser", () => {
describe("#parse", () => {
it("returns matched command with the string", () => {
const sut = new CommandParser();
expect(sut.parse("open")).toEqual(Command.Open);
expect(sut.parse("w")).toEqual(Command.WindowOpen);
expect(sut.parse("bdelete!")).toEqual(Command.BufferDeleteForce);
expect(() => sut.parse("harakiri")).toThrow(UnknownCommandError);
});
});
});
|