import { describe, expect, it } from 'vitest' import { createMarkdown } from '../src/core/markdown' import { resolveOptions } from '../src/core/options' describe('transform', async () => { const options = resolveOptions({}) const markdownToVue = createMarkdown(options) it('basic', async () => { const md = `--- title: Hey --- # Hello - A - B - C ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('style', async () => { const md = ` # Hello ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('script setup', async () => { const md = ` # Hello ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('exposes frontmatter', async () => { const md = `--- title: Hey --- # Hello` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('couldn\'t expose frontmatter', async () => { const md = `--- title: Hey --- ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('escapeCodeTagInterpolation', async () => { const md = `
{{hello}}
\`\`\`ts
{{hello}}
\`\`\` ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('frontmatter interpolation', async () => { const md = ` --- name: 'My Cool App' --- # Hello World This is {{frontmatter.name}} ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('vue directives', async () => { const md = ` --- name: 'My Cool App' --- ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('export keyword frontmatters', async () => { const md = ` --- class: 'text' default: 'foo' --- Hello ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) it('code escape', async () => { const md = ` Hello \`{{ world }}\` \`\`\`js console.log(\`{{ world }}\`) \`\`\` ` expect((await markdownToVue('', md)).code).toMatchSnapshot() }) })