Skip to content

Commit 58773eb

Browse files
committed
test(rules): add cases for two missing branches with defaulting optionals
1 parent 24c0cca commit 58773eb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/rules/header-max-length.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,18 @@ test(outcome, false, 'chore', 'deps', 'Dependabot', maxDepsLength + 1);
7171
test(outcome, false, 'build', 'deps', 'Dependabot', maxDepsLength + 1);
7272
test(outcome, false, 'chore', 'deps-dev', 'Dependabot', maxDepsLength + 1);
7373
test(outcome, false, 'build', 'deps-dev', 'Dependabot', maxDepsLength + 1);
74+
75+
test('uses zero header length when "parsed.header" is "null"', (t) => {
76+
const parsed = commit('', undefined, config.maxLength + 1);
77+
parsed.header = null;
78+
t.deepEqual(headerMaxLength(parsed), [true]);
79+
});
80+
81+
test('uses empty string when "parsed.type" is "undefined"', (t) => {
82+
const parsed = commit('', undefined, config.maxLength + 1);
83+
delete parsed.type;
84+
t.deepEqual(headerMaxLength(parsed), [
85+
false,
86+
failedMessage(false, config.maxLength + 1),
87+
]);
88+
});

0 commit comments

Comments
 (0)