1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-04 16:09:59 +00:00
elk/tests/content.test.ts

22 lines
586 B
TypeScript
Raw Normal View History

2022-11-25 08:25:56 +00:00
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()
})
})