Skip to content

Commit dcaa7a4

Browse files
committed
fix: correct validation to be aligned with rules
1 parent 9a45a33 commit dcaa7a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

@commitlint/prompt/src/library/get-forced-case-fn.test.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ test('should not apply', () => {
3333

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

3939
expect(() =>
40-
getForcedCaseFn(['name', [RuleConfigSeverity.Warning, 'always', 'foo']])
40+
getForcedCaseFn(['name', [RuleConfigSeverity.Warning, 'always', 'foo']])('')
4141
).toThrow('Unknown target case "foo"');
4242
});
4343

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

9394
rule = getForcedCaseFn([
9495
'name',
9596
[RuleConfigSeverity.Warning, 'always', 'sentencecase'],
9697
]);
97-
expect(rule('TEST_FOOBar-baz baz')).toBe('Test_foobar-baz baz');
98+
expect(rule('TEST_FOOBar-baz baz')).toBe('TEST_FOOBar-baz baz');
9899

99100
rule = getForcedCaseFn([
100101
'name',

0 commit comments

Comments
 (0)