fix(products): extract lexical AST and JSON-LD data correctly from productTabs block
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
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
This commit is contained in:
27
tests/lexical.test.ts
Normal file
27
tests/lexical.test.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user