- 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)
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { generateBookmarklet, encodeCapturePayload, CapturePayload } from '@/lib/external-capture'
|
|
|
|
describe('external-capture', () => {
|
|
describe('generateBookmarklet', () => {
|
|
it('generates a valid javascript bookmarklet string', () => {
|
|
const bookmarklet = generateBookmarklet()
|
|
expect(bookmarklet).toContain('javascript:')
|
|
expect(bookmarklet.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
it('contains the capture URL', () => {
|
|
const bookmarklet = generateBookmarklet()
|
|
expect(bookmarklet).toContain('capture')
|
|
})
|
|
})
|
|
|
|
describe('encodeCapturePayload', () => {
|
|
it('encodes title in params', () => {
|
|
const payload: CapturePayload = { title: 'Test Note', url: '', selection: '' }
|
|
const encoded = encodeCapturePayload(payload)
|
|
expect(encoded).toContain('title=Test')
|
|
})
|
|
|
|
it('encodes url in params', () => {
|
|
const payload: CapturePayload = { title: '', url: 'https://example.com', selection: '' }
|
|
const encoded = encodeCapturePayload(payload)
|
|
expect(encoded).toContain('url=https%3A%2F%2Fexample.com')
|
|
})
|
|
|
|
it('encodes selection in params', () => {
|
|
const payload: CapturePayload = { title: '', url: '', selection: 'Selected text' }
|
|
const encoded = encodeCapturePayload(payload)
|
|
expect(encoded).toContain('selection=Selected')
|
|
})
|
|
})
|
|
})
|