import { renderMarkdown } from '../dist/index.js'; import chai from 'chai'; describe('expressions', () => { it('should be able to serialize bare expession', async () => { const { code } = await renderMarkdown(`{a}`, {}); chai.expect(code).to.equal(`{a}`); }); it('should be able to serialize expression inside component', async () => { const { code } = await renderMarkdown(`{a}`, {}); chai.expect(code).to.equal(`\n{a}\n`); }); it('should be able to serialize expression inside markdown', async () => { const { code } = await renderMarkdown(`# {frontmatter.title}`, {}); chai .expect(code) .to.equal(`

{frontmatter.title}

`); }); it('should be able to serialize complex expression inside markdown', async () => { const { code } = await renderMarkdown(`# Hello {frontmatter.name}`, {}); chai .expect(code) .to.equal(`

Hello {frontmatter.name}

`); }); it('should be able to serialize complex expression with markup inside markdown', async () => { const { code } = await renderMarkdown(`# Hello {frontmatter.name}`, {}); chai .expect(code) .to.equal( `

Hello {frontmatter.name}

` ); }); it('should be able to serialize function expression', async () => { const { code } = await renderMarkdown( `{frontmatter.list.map(item =>

{item}

)}`, {} ); chai.expect(code).to.equal(`{frontmatter.list.map(item =>

{item}

)}`); }); });