marked-mfm/test/index.test.js

20 lines
755 B
JavaScript
Raw Normal View History

2022-07-08 08:32:20 +00:00
import { marked } from 'marked'
import markedMfm from '../src/index.js'
describe('marked-mfm', () => {
test('inline', () => {
marked.use(markedMfm)
2022-07-08 08:32:20 +00:00
expect(marked('$[x2 this text is bigger]')).toBe('<p><span style="display: inline-block" class="x2">this text is bigger</span></p>\n')
})
test('nested', () => {
marked.use(markedMfm)
2022-07-08 08:32:20 +00:00
expect(marked('$[twitch twitch $[sparkle sparkle]]')).toBe('<p><span style="display: inline-block" class="twitch">twitch <span style="display: inline-block" class="sparkle">sparkle</span></span></p>\n')
})
2022-07-08 08:59:00 +00:00
test('invalid', () => {
marked.use(markedMfm)
expect(marked('$[invalid $[x2 test]]')).toBe('<p>$[invalid <span style="display: inline-block" class="x2">test</span>]</p>\n')
})
2022-07-08 08:32:20 +00:00
})