1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Chore: Fix website build (#11359)

This commit is contained in:
Henry Heino
2024-11-09 04:44:12 -08:00
committed by GitHub
parent 4a88d6ff7a
commit 3894c05217
5 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,18 @@
import { trimPostToMaximumLength } from './discourse';
describe('utils/discourse', () => {
it('trimPostToMaximumLength should allow trimming posts to a maximum length', () => {
const makeLongString = (length: number) => {
const resultParts = [];
while (resultParts.length < length) {
resultParts.push('1');
}
return resultParts.join('');
};
const longContent = makeLongString(70_000);
const trimmed = trimPostToMaximumLength(longContent);
expect(trimmed.length).toBeLessThan(65_000);
expect(trimmed).toContain(`${longContent.substring(0, 65_000 - 153)}...\n\n**Note**:`);
});
});