2022-02-04 04:31:54 -05:00
|
|
|
/* 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')
|
|
|
|
})
|
2022-03-07 05:48:53 -05:00
|
|
|
|
|
|
|
it('Should convert tags to plain text', function () {
|
|
|
|
const result = mdToOneLinePlainText(`#déconversion\n#newage\n#histoire`)
|
|
|
|
|
|
|
|
expect(result).to.equal('#déconversion #newage #histoire')
|
|
|
|
})
|
2022-02-04 04:31:54 -05:00
|
|
|
})
|
|
|
|
})
|