pages235/src/markdownToFormattedText.test.ts
gguio 85c0eb8c5b
feat: Sign editor with formatting support! (+2 settings) (#86)
Co-authored-by: gguio <nikvish150@gmail.com>
Co-authored-by: Vitaly Turovsky <vital2580@icloud.com>
2024-03-23 16:21:36 +03:00

39 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import markdownToFormattedText from './markdownToFormattedText'
describe('markdownToFormattedText', () => {
it('should convert markdown to formatted text', () => {
const markdown = '**bold** *italic* [link](https://example.com) k `code`'
const text = markdownToFormattedText(markdown)
const command = '/data merge block ~ ~ ~ {Text1:\'' + JSON.stringify(text[0]) + '\',Text2: \'' + JSON.stringify(text[1]) + '\',Text3:\'' + JSON.stringify(text[2]) + '\',Text4:\'' + JSON.stringify(text[3]) + '\'}' // mojangson
expect(text).toMatchInlineSnapshot(`
[
[
[
{
"bold": true,
"text": "bold",
},
{
"text": " ",
},
{
"italic": true,
"text": "italic",
},
{
"text": " ",
},
{
"text": " k ",
},
"code",
],
],
"",
"",
"",
]
`)
})
})