1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Fix plaintext markdown converter

This commit is contained in:
Chocobozzz 2022-02-04 10:31:54 +01:00
parent 457c83486e
commit c68e2b2d22
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 104 additions and 27 deletions

View file

@ -0,0 +1,34 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { mdToOneLinePlainText } from '@server/helpers/markdown'
import { expect } from 'chai'
describe('Markdown helpers', function () {
describe('Plain text', function () {
it('Should convert a list to plain text', function () {
const result = mdToOneLinePlainText(`* list 1
* list 2
* list 3`)
expect(result).to.equal('list 1, list 2, list 3')
})
it('Should convert a list with indentation to plain text', function () {
const result = mdToOneLinePlainText(`Hello:
* list 1
* list 2
* list 3`)
expect(result).to.equal('Hello: list 1, list 2, list 3')
})
it('Should convert HTML to plain text', function () {
const result = mdToOneLinePlainText(`**Hello** <strong>coucou</strong>`)
expect(result).to.equal('Hello coucou')
})
})
})