Skip to content

Commit 216fd4d

Browse files
aichbauerJPeer264
authored andcommitted
Feat: lowercase types (closes #32) (#33)
* Test: lowercase and uppercase * Feat: lowercase types * Test: fix remove only
1 parent 5bfa0d4 commit 216fd4d

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

.sgcrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"scope": false,
33
"body": true,
44
"emoji": false,
5+
"lowercaseTypes": false,
56
"initial-commit": {
67
"isEnabled": true,
78
"emoji": ":tada:",

lib/questions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const choices = (config) => {
77

88
config.types.forEach((type) => {
99
const emoji = config.emoji && type.emoji ? `${type.emoji} ` : '';
10-
const configType = type.type;
10+
const configType = config.lowercaseTypes ? type.type.toLowerCase() : type.type;
1111
const description = type.description || '';
1212

1313
choicesList.push({

test/fixtures/.sgcrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"scope": false,
33
"body": true,
44
"emoji": false,
5+
"lowercaseTypes": false,
56
"initial-commit": {
67
"isEnabled": true,
78
"emoji": ":tada:",

test/questions.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ test('check the values of the question object', (t) => {
6666
t.is(typeof questionsList, 'object');
6767
});
6868

69+
test('TYPES | upperCase (default)', (t) => {
70+
const sgc = getConfig(path.join(fixtures, '.sgcrc'));
71+
72+
const choicesList = choices(sgc);
73+
74+
t.is(choicesList[0].value, 'Add:');
75+
});
76+
77+
test('TYPES | lowerCase', (t) => {
78+
const sgc = getConfig(path.join(fixtures, '.sgcrc'));
79+
80+
sgc.lowercaseTypes = true;
81+
82+
const choicesList = choices(sgc);
83+
84+
t.is(choicesList[0].value, 'add:');
85+
});
86+
6987
test('SCOPE | check if scope is off by default', (t) => {
7088
const config = getConfig();
7189
const questionsList = questions(config);

0 commit comments

Comments
 (0)