From f25ac3e4899c1f7235f9b5376bc283c767bb1626 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Dec 2024 10:48:49 +0100 Subject: [PATCH] Fix tests --- packages/tests/src/server-helpers/markdown.ts | 10 +++++----- server/core/lib/html/shared/tags-html.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/tests/src/server-helpers/markdown.ts b/packages/tests/src/server-helpers/markdown.ts index 95d172d7669..ce727bc64ef 100644 --- a/packages/tests/src/server-helpers/markdown.ts +++ b/packages/tests/src/server-helpers/markdown.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import { mdToOneLinePlainText } from '@peertube/peertube-server/core/helpers/markdown.js' +import { mdToPlainText } from '@peertube/peertube-server/core/helpers/markdown.js' import { expect } from 'chai' describe('Markdown helpers', function () { @@ -8,7 +8,7 @@ describe('Markdown helpers', function () { describe('Plain text', function () { it('Should convert a list to plain text', function () { - const result = mdToOneLinePlainText(`* list 1 + const result = mdToPlainText(`* list 1 * list 2 * list 3`) @@ -16,7 +16,7 @@ describe('Markdown helpers', function () { }) it('Should convert a list with indentation to plain text', function () { - const result = mdToOneLinePlainText(`Hello: + const result = mdToPlainText(`Hello: * list 1 * list 2 * list 3`) @@ -25,13 +25,13 @@ describe('Markdown helpers', function () { }) it('Should convert HTML to plain text', function () { - const result = mdToOneLinePlainText(`**Hello** coucou`) + const result = mdToPlainText(`**Hello** coucou`) expect(result).to.equal('Hello coucou') }) it('Should convert tags to plain text', function () { - const result = mdToOneLinePlainText(`#déconversion\n#newage\n#histoire`) + const result = mdToPlainText(`#déconversion\n#newage\n#histoire`) expect(result).to.equal('#déconversion #newage #histoire') }) diff --git a/server/core/lib/html/shared/tags-html.ts b/server/core/lib/html/shared/tags-html.ts index 9f1dfa78334..cb3e7dd2db0 100644 --- a/server/core/lib/html/shared/tags-html.ts +++ b/server/core/lib/html/shared/tags-html.ts @@ -1,11 +1,11 @@ import { escapeAttribute, escapeHTML } from '@peertube/peertube-core-utils' import { mdToPlainText } from '@server/helpers/markdown.js' import truncate from 'lodash-es/truncate.js' +import { parse } from 'node-html-parser' import { CONFIG } from '../../../initializers/config.js' import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, WEBSERVER } from '../../../initializers/constants.js' import { MVideo, MVideoPlaylist } from '../../../types/models/index.js' import { Hooks } from '../../plugins/hooks.js' -import { parse } from 'node-html-parser'; type Tags = { forbidIndexation: boolean