mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-24 18:26:17 +03:00
27 lines
701 B
TypeScript
27 lines
701 B
TypeScript
/**
|
|
* @vitest-environment jsdom
|
|
*/
|
|
import { describe, expect, it } from 'vitest'
|
|
import { htmlToText } from '../composables/content'
|
|
|
|
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
|
|
\`\`\`"
|
|
`)
|
|
})
|
|
|
|
it('bold & italic', () => {
|
|
expect(htmlToText('<p>text <b>bold</b> <em>italic</em></p>'))
|
|
.toMatchInlineSnapshot('"text **bold** *italic*"')
|
|
})
|
|
})
|