You've already forked joplin
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:
18
packages/tools/utils/discourse.test.ts
Normal file
18
packages/tools/utils/discourse.test.ts
Normal 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**:`);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user