-
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.
feat(type): add API method to tell if commit type is public or chore, c…
…lose #12
- Loading branch information
Showing
8 changed files
with
98 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
exports['determines if commit is public 1'] = { | ||
"name": "isPublicCommitType", | ||
"behavior": [ | ||
{ | ||
"given": "major", | ||
"expect": true | ||
}, | ||
{ | ||
"given": "break", | ||
"expect": true | ||
}, | ||
{ | ||
"given": "minor", | ||
"expect": true | ||
}, | ||
{ | ||
"given": "feat", | ||
"expect": true | ||
}, | ||
{ | ||
"given": "fix", | ||
"expect": true | ||
}, | ||
{ | ||
"given": "patch", | ||
"expect": true | ||
}, | ||
{ | ||
"given": "chore", | ||
"expect": false | ||
}, | ||
{ | ||
"given": "anything else", | ||
"expect": false | ||
} | ||
] | ||
} | ||
|
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
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,15 @@ | ||
'use strict' | ||
|
||
const snapshot = require('snap-shot') | ||
|
||
/* global describe, it */ | ||
describe('is-public', () => { | ||
const isPublic = require('./is-public') | ||
|
||
it('determines if commit is public', () => { | ||
snapshot(isPublic, | ||
'major', 'break', 'minor', 'feat', 'fix', 'patch', 'chore', | ||
'anything else' | ||
) | ||
}) | ||
}) |
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,20 @@ | ||
const validMessage = require('./valid-message') | ||
|
||
// users only care about these commit types | ||
const publicTypes = { | ||
major: true, | ||
break: true, | ||
minor: true, | ||
feat: true, | ||
fix: true, | ||
patch: true | ||
} | ||
|
||
function isPublicCommitType (s) { | ||
if (!validMessage.isValidType(s)) { | ||
return false | ||
} | ||
return Boolean(publicTypes[s]) | ||
} | ||
|
||
module.exports = isPublicCommitType |
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