summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks/__tests__
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/hooks/__tests__')
-rw-r--r--apps/web/src/hooks/__tests__/use-keyboard-shortcuts-help.test.ts46
1 files changed, 46 insertions, 0 deletions
diff --git a/apps/web/src/hooks/__tests__/use-keyboard-shortcuts-help.test.ts b/apps/web/src/hooks/__tests__/use-keyboard-shortcuts-help.test.ts
new file mode 100644
index 00000000..52c7dcd6
--- /dev/null
+++ b/apps/web/src/hooks/__tests__/use-keyboard-shortcuts-help.test.ts
@@ -0,0 +1,46 @@
+import { describe, it, expect, beforeEach } from 'vitest'
+import { renderHook } from '@testing-library/react'
+import { useKeyboardShortcutsHelp } from '../use-keyboard-shortcuts-help'
+import { useKeybindingsStore } from '../../stores/keybindings-store'
+
+describe('useKeyboardShortcutsHelp', () => {
+ beforeEach(() => {
+ // Reset store to default state before each test
+ useKeybindingsStore.getState().resetToDefaults()
+ })
+
+ it('should format Enter key correctly in shortcuts', () => {
+ const { result } = renderHook(() => useKeyboardShortcutsHelp())
+
+ // Find the goto-start action in shortcuts
+ const gotoStartShortcut = result.current.shortcuts.find(
+ shortcut => shortcut.action === 'goto-start'
+ )
+
+ expect(gotoStartShortcut).toBeDefined()
+ expect(gotoStartShortcut?.keys).toContain('Enter')
+ expect(gotoStartShortcut?.keys).toContain('Home')
+ })
+
+ it('should include goto-start action with correct description', () => {
+ const { result } = renderHook(() => useKeyboardShortcutsHelp())
+
+ const gotoStartShortcut = result.current.shortcuts.find(
+ shortcut => shortcut.action === 'goto-start'
+ )
+
+ expect(gotoStartShortcut).toBeDefined()
+ expect(gotoStartShortcut?.description).toBe('Go to timeline start')
+ expect(gotoStartShortcut?.category).toBe('Navigation')
+ })
+
+ it('should have multiple keys for goto-start action', () => {
+ const { result } = renderHook(() => useKeyboardShortcutsHelp())
+
+ const gotoStartShortcut = result.current.shortcuts.find(
+ shortcut => shortcut.action === 'goto-start'
+ )
+
+ expect(gotoStartShortcut?.keys.length).toBeGreaterThanOrEqual(2)
+ })
+}) \ No newline at end of file