mirror of
https://github.com/elk-zone/elk
synced 2024-12-04 01:38:06 +09:00
22 lines
586 B
TypeScript
22 lines
586 B
TypeScript
import type { Emoji } from 'masto'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { renderToString } from 'vue/server-renderer'
|
|
import { contentToVNode } from '~/composables/content'
|
|
|
|
async function render(content: string, emojis?: Record<string, Emoji[]>) {
|
|
const vnode = contentToVNode(content, emojis)
|
|
const html = (await renderToString(vnode))
|
|
.replace(/<!--[\[\]]-->/g, '')
|
|
return {
|
|
vnode,
|
|
html,
|
|
}
|
|
}
|
|
|
|
describe('rich-content', () => {
|
|
it('plain', async () => {
|
|
const { html } = await render('Hello\nWorld')
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
})
|