forked from leoforfree/cz-customizable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add options subjectSeparator typePrefix and typeSuffix (leoforf…
- Loading branch information
1 parent
48dc07d
commit 3a4b4d0
Showing
5 changed files
with
101 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const buildCommit = require('../buildCommit'); | ||
|
||
describe('buildCommit()', () => { | ||
const answers = { | ||
type: 'feat', | ||
scope: 'app', | ||
subject: 'this is a new feature', | ||
}; | ||
|
||
it('subject with default subject separator', () => { | ||
const options = {}; | ||
expect(buildCommit(answers, options)).toEqual('feat(app): this is a new feature'); | ||
}); | ||
|
||
it('subject with custom subject separator option', () => { | ||
const options = { | ||
subjectSeparator: ' - ', | ||
}; | ||
expect(buildCommit(answers, options)).toEqual('feat(app) - this is a new feature'); | ||
}); | ||
|
||
it('subject 1 empty character separator', () => { | ||
const options = { | ||
subjectSeparator: ' ', | ||
}; | ||
expect(buildCommit(answers, options)).toEqual('feat(app) this is a new feature'); | ||
}); | ||
|
||
describe('without scope', () => { | ||
it('subject without scope', () => { | ||
const answersNoScope = { | ||
type: 'feat', | ||
subject: 'this is a new feature', | ||
}; | ||
const options = {}; | ||
expect(buildCommit(answersNoScope, options)).toEqual('feat: this is a new feature'); | ||
}); | ||
|
||
it('subject without scope', () => { | ||
const answersNoScope = { | ||
type: 'feat', | ||
subject: 'this is a new feature', | ||
}; | ||
const options = { | ||
subjectSeparator: ' - ', | ||
}; | ||
expect(buildCommit(answersNoScope, options)).toEqual('feat - this is a new feature'); | ||
}); | ||
}); | ||
|
||
describe('type prefix and type suffix', () => { | ||
it('subject with both', () => { | ||
const answersNoScope = { | ||
type: 'feat', | ||
subject: 'this is a new feature', | ||
}; | ||
const options = { | ||
typePrefix: '[', | ||
typeSuffix: ']', | ||
subjectSeparator: ' ', | ||
}; | ||
expect(buildCommit(answersNoScope, options)).toEqual('[feat] this is a new feature'); | ||
}); | ||
}); | ||
}); |