/** * Markdown Formatter Tests */ import { formatMarkdown } from '../utils/markdown'; describe('formatMarkdown', () => { it('should convert markdown to formatted terminal text', () => { const input = '**bold text**'; const output = formatMarkdown(input); expect(output).toBeTruthy(); expect(typeof output).toBe('string'); }); it('should handle code blocks', () => { const input = '```javascript\nconst x = 1;\n```'; const output = formatMarkdown(input); expect(output).toBeTruthy(); }); it('should handle plain text', () => { const input = 'This is plain text'; const output = formatMarkdown(input); expect(output).toContain('This is plain text'); }); it('should handle headings', () => { const input = '# Main Heading\n## Sub Heading'; const output = formatMarkdown(input); expect(output).toBeTruthy(); }); it('should handle lists', () => { const input = '- Item 1\n- Item 2\n- Item 3'; const output = formatMarkdown(input); expect(output).toBeTruthy(); }); it('should handle empty string', () => { const output = formatMarkdown(''); expect(output).toBe(''); }); it('should handle complex markdown with multiple elements', () => { const input = `# Title **Bold** and *italic* text - List item 1 - List item 2 \`\`\`js const x = 1; \`\`\``; const output = formatMarkdown(input); expect(output).toBeTruthy(); expect(typeof output).toBe('string'); }); it('should fallback to plain text on parsing error', () => { // marked handles invalid markdown gracefully, so this tests the try-catch const input = 'Normal text that should work fine'; const output = formatMarkdown(input); expect(output).toBeTruthy(); }); });