import { describe, it, expect } from 'vitest';
import { convertHtmlToBlockNote, convertMarkdownToBlocks } from './contentConversion';
describe('Email Content Conversion Logic', () => {
it('should handle block links split by Turndown (Link wrapping Header + Text) via raw Markdown', () => {
// Directly test the parser logic with the split syntax Turndown produces
const splitMarkdown = [
'[',
'',
'',
'### Big News Story',
'',
'This is a summary of the news.',
'',
'Read more](https://example.com/article)'
].join('\n');
const blocks = convertMarkdownToBlocks(splitMarkdown);
// Verify key content is present
const hasImageText = blocks.some(b => JSON.stringify(b).includes('Article Image'));
expect(hasImageText).toBe(true);
const hasHeaderText = blocks.some(b => JSON.stringify(b).includes('Big News Story'));
expect(hasHeaderText).toBe(true);
// Verify linking (URL presence)
const hasLink = blocks.some(b => JSON.stringify(b).includes('https://example.com/article'));
expect(hasLink).toBe(true);
});
it('should handle simple block links (Link wrapping Text)', async () => {
const simpleHtml = `
Read more