feat: MVP-5 P2 - Export/Import, Settings, Tests y Validaciones
- Ticket 10: Navegación completa de listas por teclado (↑↓ Enter E F P) - Ticket 13: Historial de navegación contextual con recent-context-list - Ticket 17: Exportación mejorada a Markdown con frontmatter - Ticket 18: Exportación HTML simple y legible - Ticket 19: Importador Markdown mejorado con frontmatter, tags, wiki links - Ticket 20: Importador Obsidian-compatible (wiki links, #tags inline) - Ticket 21: Centro de respaldo y portabilidad en Settings - Ticket 22: Configuración visible de feature flags - Ticket 24: Tests de command palette y captura externa - Ticket 25: Harden de validaciones y límites (50MB backup, 10K notas, etc)
This commit is contained in:
56
__tests__/command-items.test.ts
Normal file
56
__tests__/command-items.test.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { commands, CommandItem } from '@/lib/command-items'
|
||||
|
||||
describe('command-items', () => {
|
||||
describe('commands array', () => {
|
||||
it('contains navigation commands', () => {
|
||||
const navCommands = commands.filter((cmd) => cmd.group === 'navigation')
|
||||
expect(navCommands.length).toBeGreaterThan(0)
|
||||
expect(navCommands.some((cmd) => cmd.id === 'nav-dashboard')).toBe(true)
|
||||
expect(navCommands.some((cmd) => cmd.id === 'nav-notes')).toBe(true)
|
||||
expect(navCommands.some((cmd) => cmd.id === 'nav-settings')).toBe(true)
|
||||
})
|
||||
|
||||
it('contains action commands', () => {
|
||||
const actionCommands = commands.filter((cmd) => cmd.group === 'actions')
|
||||
expect(actionCommands.length).toBeGreaterThan(0)
|
||||
expect(actionCommands.some((cmd) => cmd.id === 'action-new')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('command item structure', () => {
|
||||
it('each command has required fields', () => {
|
||||
commands.forEach((cmd: CommandItem) => {
|
||||
expect(cmd.id).toBeDefined()
|
||||
expect(cmd.label).toBeDefined()
|
||||
expect(cmd.group).toBeDefined()
|
||||
expect(typeof cmd.id).toBe('string')
|
||||
expect(typeof cmd.label).toBe('string')
|
||||
expect(['navigation', 'actions', 'search', 'recent']).toContain(cmd.group)
|
||||
})
|
||||
})
|
||||
|
||||
it('commands have keywords for search', () => {
|
||||
commands.forEach((cmd: CommandItem) => {
|
||||
if (cmd.keywords) {
|
||||
expect(Array.isArray(cmd.keywords)).toBe(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('command filtering', () => {
|
||||
it('can filter by label', () => {
|
||||
const filtered = commands.filter((cmd) =>
|
||||
cmd.label.toLowerCase().includes('dashboard')
|
||||
)
|
||||
expect(filtered.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('can filter by keywords', () => {
|
||||
const filtered = commands.filter((cmd) =>
|
||||
cmd.keywords?.some((k) => k.includes('home'))
|
||||
)
|
||||
expect(filtered.length).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user