Skip to content

Commit cd1c7ea

Browse files
committed
test: add test for more conditions
1 parent 240fcbe commit cd1c7ea

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/prompts/footer-maker.test.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,43 @@ describe('footerMaker', () => {
3333
});
3434

3535
describe('breakingChangeMessageFactory', () => {
36-
it('should show a message when footer has maximum length rule', () => {
36+
it('should show a message when footer has maximum length rule set', () => {
3737
const rules: QualifiedRules = { 'footer-max-length': [RuleConfigSeverity.Error, 'always', 50] };
3838

3939
const fixture = breakingChangeMessageFactory(rules);
4040

4141
const result = fixture();
4242
expect(result).toBe('Describe the breaking changes (max 50 chars):\n');
4343
});
44+
45+
it('should show a message when footer has not maximum length rule set', () => {
46+
const rules: QualifiedRules = { 'footer-max-length': [RuleConfigSeverity.Disabled, 'always', 50] };
47+
48+
const fixture = breakingChangeMessageFactory(rules);
49+
50+
const result = fixture();
51+
expect(result).toBe('Describe the breaking changes:\n');
52+
});
4453
});
4554

4655
describe('issuesMessageFactory', () => {
47-
it('should show a message when footer has maximum length rule', () => {
56+
it('should show a message when footer has maximum length rule set', () => {
4857
const rules: QualifiedRules = { 'footer-max-length': [RuleConfigSeverity.Error, 'always', 88] };
4958

5059
const fixture = issuesMessageFactory(rules);
5160

5261
const result = fixture();
5362
expect(result).toBe('Add issue references (e.g. "fix #123", "re #123".) (max 88 chars):\n');
5463
});
64+
65+
it('should show a message when footer has not maximum length rule set', () => {
66+
const rules: QualifiedRules = { 'footer-max-length': [RuleConfigSeverity.Disabled, 'always', 88] };
67+
68+
const fixture = issuesMessageFactory(rules);
69+
70+
const result = fixture();
71+
expect(result).toBe('Add issue references (e.g. "fix #123", "re #123".):\n');
72+
});
5573
});
5674

5775
describe('breakingTransformFactory', () => {

0 commit comments

Comments
 (0)