Skip to content

Commit

Permalink
test: add test for more conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
xeptore committed Sep 4, 2021
1 parent 240fcbe commit cd1c7ea
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/prompts/footer-maker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,43 @@ describe('footerMaker', () => {
});

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

const fixture = breakingChangeMessageFactory(rules);

const result = fixture();
expect(result).toBe('Describe the breaking changes (max 50 chars):\n');
});

it('should show a message when footer has not maximum length rule set', () => {
const rules: QualifiedRules = { 'footer-max-length': [RuleConfigSeverity.Disabled, 'always', 50] };

const fixture = breakingChangeMessageFactory(rules);

const result = fixture();
expect(result).toBe('Describe the breaking changes:\n');
});
});

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

const fixture = issuesMessageFactory(rules);

const result = fixture();
expect(result).toBe('Add issue references (e.g. "fix #123", "re #123".) (max 88 chars):\n');
});

it('should show a message when footer has not maximum length rule set', () => {
const rules: QualifiedRules = { 'footer-max-length': [RuleConfigSeverity.Disabled, 'always', 88] };

const fixture = issuesMessageFactory(rules);

const result = fixture();
expect(result).toBe('Add issue references (e.g. "fix #123", "re #123".):\n');
});
});

describe('breakingTransformFactory', () => {
Expand Down

0 comments on commit cd1c7ea

Please sign in to comment.