Skip to content

Commit

Permalink
fix(core): use correct report message #192
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Dec 8, 2017
1 parent 949579c commit e3a78bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion @commitlint/core/src/rules/subject-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default (parsed, when, value) => {

return [
negated(when) ? !result : result,
message([`subject must`, negated ? `not` : null, `be ${list}`])
message([`subject must`, negated(when) ? `not` : null, `be ${list}`])
];
};
18 changes: 18 additions & 0 deletions @commitlint/core/src/rules/subject-case.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,21 @@ test('with startcase subject should succeed for "always startcase"', async t =>
const expected = true;
t.is(actual, expected);
});

test('should use expected message with "always"', async t => {
const [, message] = subjectCase(
await parsed.uppercase,
'always',
'lower-case'
);
t.true(message.indexOf('must be lower-case') > -1);
});

test('should use expected message with "never"', async t => {
const [, message] = subjectCase(
await parsed.uppercase,
'never',
'upper-case'
);
t.true(message.indexOf('must not be upper-case') > -1);
});

0 comments on commit e3a78bc

Please sign in to comment.