Skip to content

Commit

Permalink
refactor: ショートカットキーに存在するのにdefaultHotkeySettingsに無いものを追加 (VOICEVOX#2423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Dec 28, 2024
1 parent d748f6a commit eb5dd04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/domain/hotkeyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const hotkeyActionNameSchema = z.enum([
"貼り付け",
"すべて選択",
"選択解除",
"全セルを選択",
`1${actionPostfixSelectNthCharacter}`,
`2${actionPostfixSelectNthCharacter}`,
`3${actionPostfixSelectNthCharacter}`,
Expand Down
5 changes: 4 additions & 1 deletion src/type/utility.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/** ブランド型を作る */
export type Brand<K, T> = K & { __brand: T };

// XとYが同じ型かどうかを判定する
/*
* XとYが同じ型かどうかを判定する。
* const _: IsEqual<X, Y> = true; のように使う。
**/
export type IsEqual<X, Y> =
(<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2
? true
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/domain/hotkeyAction.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
defaultHotkeySettings,
hotkeyActionNameSchema,
} from "@/domain/hotkeyAction";

test("すべてのホットキーに初期値が設定されている", async () => {
const allActionNames = new Set(hotkeyActionNameSchema.options);
const defaultHotkeyActionsNames = new Set(
defaultHotkeySettings.map((setting) => setting.action),
);
expect(allActionNames).toEqual(defaultHotkeyActionsNames);
});

0 comments on commit eb5dd04

Please sign in to comment.