0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 21:48:32 +00:00
renovatebot_renovate/lib/modules/platform/utils/pr-body.spec.ts
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00

30 lines
857 B
TypeScript

import { Fixtures } from '../../../../test/fixtures';
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();
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);
});
});
});