1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-10 02:49:58 +00:00
elk/tests/nuxt/html-to-text.test.ts

24 lines
602 B
TypeScript
Raw Normal View History

2022-11-30 04:50:29 +00:00
import { describe, expect, it } from 'vitest'
describe('html-to-text', () => {
it('inline code', () => {
expect(htmlToText('<p>text <code>code</code> inline</p>'))
.toMatchInlineSnapshot('"text `code` inline"')
})
it('code block', () => {
expect(htmlToText('<p>text </p><pre><code class="language-js">code</code></pre>'))
.toMatchInlineSnapshot(`
"text
\`\`\`js
code
\`\`\`"
`)
2022-11-30 04:50:29 +00:00
})
it('bold & italic', () => {
expect(htmlToText('<p>text <b>bold</b> <em>italic</em></p>'))
.toMatchInlineSnapshot('"text **bold** *italic*"')
})
})