Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/prompts/body-maker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ describe('body-maker', () => {

expect(result).toBe(expected);
});

it('should prepend body with and leading empty line', () => {
const rules: Rules = {
'body-leading-blank': [Level.Error, 'always', undefined],
'body-max-line-length': [Level.Error, 'never', Infinity]
};
const userTypedBody = 'my message should be prepended with an empty new line';

const result = filterFactory(rules)(userTypedBody);

expect(result).toBe('\nmy message should be prepended with an empty new line');
});
});

describe('transformerFactory', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/prompts/body-maker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export function filterFactory(rules: Rules) {
return (value: string) =>
pipeWith<string>(
value,
v => leadingBlankFilter(v, rules['body-leading-blank']),
v => maxLineLengthFilter(v, rules['body-max-line-length']),
v => leadingBlankFilter(v, rules['body-leading-blank']),
v => v.replace(/\\n/g, '\n')
);
}
Expand Down