Skip to content
Source
Sign inSign up

projectScriptKeybindings.test.ts

19 lines788 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { commandForProjectScript } from "../projectScripts";
4import {
5 decodeProjectScriptKeybindingRule,
6 keybindingValueForCommand,
7 PROJECT_SCRIPT_KEYBINDING_INVALID_MESSAGE,
8} from "./projectScriptKeybindings";
9​
10describe("projectScriptKeybindings", () => {
11 it("can edit or delete a legacy script without a shortcut", () => {
12 const command = commandForProjectScript("install-javascript-dependencies");
13 expect(keybindingValueForCommand([], command)).toBeNull();
14 expect(decodeProjectScriptKeybindingRule({ keybinding: null, command })).toBeNull();
15 expect(() => decodeProjectScriptKeybindingRule({ keybinding: "mod+k", command })).toThrowError(
16 PROJECT_SCRIPT_KEYBINDING_INVALID_MESSAGE,
17 );
18 });
19});