Skip to content

Commit

Permalink
fix: correct validation to be aligned with rules
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Jan 12, 2021
1 parent 9a45a33 commit dcaa7a4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions @commitlint/prompt/src/library/get-forced-case-fn.test.ts
Expand Up @@ -33,11 +33,11 @@ test('should not apply', () => {

test('should throw error on invalid casing', () => {
expect(() =>
getForcedCaseFn(['name', [RuleConfigSeverity.Warning, 'always']])
getForcedCaseFn(['name', [RuleConfigSeverity.Warning, 'always']])('')
).toThrow('Unknown target case "undefined"');

expect(() =>
getForcedCaseFn(['name', [RuleConfigSeverity.Warning, 'always', 'foo']])
getForcedCaseFn(['name', [RuleConfigSeverity.Warning, 'always', 'foo']])('')
).toThrow('Unknown target case "foo"');
});

Expand Down Expand Up @@ -88,13 +88,14 @@ test('should convert text correctly', () => {
'name',
[RuleConfigSeverity.Warning, 'always', 'sentence-case'],
]);
expect(rule('TEST_FOOBar-baz baz')).toBe('Test_foobar-baz baz');
expect(rule('TEST_FOOBar-baz baz')).toBe('TEST_FOOBar-baz baz');
expect(rule('some test')).toBe('Some test');

rule = getForcedCaseFn([
'name',
[RuleConfigSeverity.Warning, 'always', 'sentencecase'],
]);
expect(rule('TEST_FOOBar-baz baz')).toBe('Test_foobar-baz baz');
expect(rule('TEST_FOOBar-baz baz')).toBe('TEST_FOOBar-baz baz');

rule = getForcedCaseFn([
'name',
Expand Down

0 comments on commit dcaa7a4

Please sign in to comment.