]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/helpers/markdown.ts
Fix plaintext markdown converter
[github/Chocobozzz/PeerTube.git] / server / tests / helpers / markdown.ts
CommitLineData
c68e2b2d
C
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import 'mocha'
4import { mdToOneLinePlainText } from '@server/helpers/markdown'
5import { expect } from 'chai'
6
7describe('Markdown helpers', function () {
8
9 describe('Plain text', function () {
10
11 it('Should convert a list to plain text', function () {
12 const result = mdToOneLinePlainText(`* list 1
13* list 2
14* list 3`)
15
16 expect(result).to.equal('list 1, list 2, list 3')
17 })
18
19 it('Should convert a list with indentation to plain text', function () {
20 const result = mdToOneLinePlainText(`Hello:
21 * list 1
22 * list 2
23 * list 3`)
24
25 expect(result).to.equal('Hello: list 1, list 2, list 3')
26 })
27
28 it('Should convert HTML to plain text', function () {
29 const result = mdToOneLinePlainText(`**Hello** <strong>coucou</strong>`)
30
31 expect(result).to.equal('Hello coucou')
32 })
33 })
34})