/** * @vitest-environment jsdom */ /* eslint-disable vue/one-component-per-file */ import type { Emoji } from 'masto' import { describe, expect, it, vi } from 'vitest' import { renderToString } from 'vue/server-renderer' import { format } from 'prettier' import { contentToVNode } from '~/composables/content-render' describe('content-rich', () => { it('empty', async () => { const { formatted } = await render('') expect(formatted).toMatchSnapshot() }) it('link + mention', async () => { // https://fosstodon.org/@ayo/109383002937620723 const { formatted } = await render('
Happy 🤗 we’re now using @vitest (migrated from chai+mocha) https://github.com/ayoayco/astro-reactive-library/pull/203
') expect(formatted).toMatchSnapshot() }) it('custom emoji', async () => { const { formatted } = await render('Daniel Roe :nuxt:', { nuxt: { shortcode: 'nuxt', url: 'https://media.mas.to/masto-public/cache/custom_emojis/images/000/288/667/original/c96ba3cb0e0e1eac.png', staticUrl: 'https://media.mas.to/masto-public/cache/custom_emojis/images/000/288/667/static/c96ba3cb0e0e1eac.png', visibleInPicker: true, }, }) expect(formatted).toMatchSnapshot() }) it('code frame', async () => { // https://mas.to/@antfu/109396489827394721 const { formatted } = await render('Testing code block
```ts
import { useMouse, usePreferredDark } from '@vueuse/core'
// tracks mouse position
const { x, y } = useMouse()
// is the user prefers dark theme
const isDark = usePreferredDark()
```
@antfu Testing
```ts
const a = hello
```
```
hello world
```
no lang
```
```