Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🧪 QA (push) Failing after 52s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
28 lines
700 B
TypeScript
28 lines
700 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { lexicalToMarkdown } from '../lib/mdx-utils';
|
|
|
|
describe('lexicalToMarkdown', () => {
|
|
it('should convert lexical AST to markdown', () => {
|
|
const ast = {
|
|
type: 'root',
|
|
children: [
|
|
{
|
|
type: 'paragraph',
|
|
children: [
|
|
{ type: 'text', text: 'Hello ' },
|
|
{ type: 'text', text: 'World', format: 1 }, // bold
|
|
],
|
|
},
|
|
{
|
|
type: 'heading',
|
|
tag: 'h2',
|
|
children: [{ type: 'text', text: 'Title' }],
|
|
},
|
|
],
|
|
};
|
|
|
|
const result = lexicalToMarkdown(ast);
|
|
expect(result).toBe('Hello **World**\n\n## Title\n\n');
|
|
});
|
|
});
|