-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(app): clarify scope-parsing behaviour for issue #50
- Loading branch information
1 parent
183ae77
commit f3f66be
Showing
2 changed files
with
32 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
const parseRawCommit = require('../src/lib/parseRawCommit'); | ||
const expect = require('chai').expect; | ||
|
||
describe('parseRawCommit', () => { | ||
const HASH = '012345HASH'; | ||
const SUBJECT = 'subject'; | ||
const BODY = 'body'; | ||
const FOOTER = 'footer'; | ||
|
||
it('should parse a "normal" feature commit', () => { | ||
const commit = `${HASH}\nfeat(scope): ${SUBJECT}\n\n${BODY}\n\n${FOOTER}`; | ||
|
||
let msg = parseRawCommit(commit); | ||
|
||
expect(msg).not.equal(null); | ||
expect(msg.hash).to.equal(HASH); | ||
expect(msg.subject).to.equal(SUBJECT); | ||
expect(msg.body).to.equal(`\n${BODY}\n\n${FOOTER}`); | ||
expect(msg.type).to.equal('feat'); | ||
expect(msg.component).to.equal('scope'); | ||
}); | ||
|
||
it('should not parse a feature commit with a scope which contains a "/" to be consistent with other commit message parsing tools', () => { | ||
const commit = `${HASH}\nfeat(scope/foo): ${SUBJECT}\n\n${BODY}\n\n${FOOTER}`; | ||
|
||
let msg = parseRawCommit(commit); | ||
|
||
expect(msg).to.equal(null); | ||
}); | ||
}); |
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