import { describe, it, expect } from 'vitest' // Reproduce the stripHtml logic from markdown-renderer to test it in isolation function stripHtml(content: string): string { return content.replace(/<[^>]*>/g, '') } describe('stripHtml', () => { it('removes simple HTML tags', () => { expect(stripHtml('

Hello

')).toBe('Hello') }) it('removes self-closing tags', () => { expect(stripHtml('Before
After')).toBe('Before After') }) it('removes img tags from GitHub pastes', () => { const input = 'Description with screenshot embedded image' expect(stripHtml(input)).toBe('Description with embedded image') }) it('removes nested HTML tags', () => { expect(stripHtml('
Bold text
')).toBe('Bold text') }) it('preserves plain text without tags', () => { expect(stripHtml('No tags here, just **markdown**')).toBe('No tags here, just **markdown**') }) it('handles empty string', () => { expect(stripHtml('')).toBe('') }) it('removes multiple img tags', () => { const input = 'text' expect(stripHtml(input)).toBe('text') }) it('removes HTML comments', () => { expect(stripHtml('Before After')).toBe('Before After') }) it('handles tags with attributes and whitespace', () => { const input = 'Link text' expect(stripHtml(input)).toBe('Link text') }) it('preserves angle brackets that are not HTML tags', () => { // This is a limitation — mathematical expressions like "x < 5" would be affected // But for our use case (stripping pasted HTML), this is acceptable expect(stripHtml('5 > 3 is true')).toBe('5 > 3 is true') }) })