0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-05-13 08:01:49 +00:00
renovatebot_renovate/lib/modules/platform/utils/pr-body.spec.ts
2025-03-13 17:52:09 +00:00

29 lines
846 B
TypeScript

import { smartTruncate } from './pr-body';
import { Fixtures } from '~test/fixtures';
const prBody = Fixtures.get('pr-body.txt');
describe('modules/platform/utils/pr-body', () => {
describe('.smartTruncate', () => {
it('truncates to 1000', () => {
const body = smartTruncate(prBody, 1000);
expect(body).toMatchSnapshot();
expect(body.length < prBody.length).toBe(true);
});
it('truncates to 300 not smart', () => {
const body = smartTruncate(prBody, 300);
expect(body).toMatchSnapshot();
expect(body).toHaveLength(300);
});
it('truncates to 10', () => {
const body = smartTruncate('Lorem ipsum dolor sit amet', 10);
expect(body).toBe('Lorem ipsu');
});
it('does not truncate', () => {
expect(smartTruncate(prBody, 60000)).toEqual(prBody);
});
});
});