0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-03-12 23:36:57 +00:00
renovatebot_renovate/lib/modules/platform/utils/pr-body.spec.ts

30 lines
857 B
TypeScript
Raw Permalink Normal View History

import { Fixtures } from '../../../../test/fixtures';
2020-03-05 20:57:24 +00:00
import { smartTruncate } from './pr-body';
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();
2021-11-08 12:16:58 +00:00
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);
2021-11-08 12:16:58 +00:00
expect(body).toBe('Lorem ipsu');
});
it('does not truncate', () => {
expect(smartTruncate(prBody, 60000)).toEqual(prBody);
});
});
});