Skip to content

Commit 8829ed9

Browse files
Merge pull request #8 from xeptore/master
bug: fix body-maker filters ordering
2 parents d48c643 + 0545208 commit 8829ed9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/prompts/body-maker.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ describe('body-maker', () => {
2929

3030
expect(result).toBe(expected);
3131
});
32+
33+
it('should prepend body with and leading empty line', () => {
34+
const rules: Rules = {
35+
'body-leading-blank': [Level.Error, 'always', undefined],
36+
'body-max-line-length': [Level.Error, 'never', Infinity]
37+
};
38+
const userTypedBody = 'my message should be prepended with an empty new line';
39+
40+
const result = filterFactory(rules)(userTypedBody);
41+
42+
expect(result).toBe('\nmy message should be prepended with an empty new line');
43+
});
3244
});
3345

3446
describe('transformerFactory', () => {

src/prompts/body-maker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export function filterFactory(rules: Rules) {
2626
return (value: string) =>
2727
pipeWith<string>(
2828
value,
29-
v => leadingBlankFilter(v, rules['body-leading-blank']),
3029
v => maxLineLengthFilter(v, rules['body-max-line-length']),
30+
v => leadingBlankFilter(v, rules['body-leading-blank']),
3131
v => v.replace(/\\n/g, '\n')
3232
);
3333
}

0 commit comments

Comments
 (0)