mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-07 20:28:46 +02:00
feat: add markdown composer backend foundation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
|
||||
import { buildMarkdownExcerpt, extractPlainTextFromMarkdown } from '@shared/utils/markdownText';
|
||||
|
||||
describe('markdown text helpers', () => {
|
||||
test('extracts readable text from common markdown syntax', () => {
|
||||
expect(
|
||||
extractPlainTextFromMarkdown('# Title\n\n**Bold** [Docs](https://example.com) and `code`.'),
|
||||
).toBe('Title Bold Docs and code.');
|
||||
});
|
||||
|
||||
test('turns fenced code blocks into readable excerpts', () => {
|
||||
expect(buildMarkdownExcerpt('```ts\nconst answer = 42;\n```', 48)).toBe('const answer = 42;');
|
||||
});
|
||||
|
||||
test('truncates after stripping markdown syntax', () => {
|
||||
expect(buildMarkdownExcerpt('**Alpha** beta gamma delta epsilon zeta eta theta', 18)).toBe(
|
||||
'Alpha beta gamma d…',
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user