From 129ea62c277dbf4da7525a31020db2623fde5db9 Mon Sep 17 00:00:00 2001 From: aichbauer Date: Mon, 7 Aug 2017 19:38:42 +0200 Subject: [PATCH 1/3] Test: lowercase and uppercase --- test/fixtures/.sgcrc | 1 + test/questions.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/fixtures/.sgcrc b/test/fixtures/.sgcrc index ad62d82..3b6de2a 100644 --- a/test/fixtures/.sgcrc +++ b/test/fixtures/.sgcrc @@ -2,6 +2,7 @@ "scope": false, "body": true, "emoji": false, + "lowercaseTypes": false, "initial-commit": { "isEnabled": true, "emoji": ":tada:", diff --git a/test/questions.js b/test/questions.js index 8a89020..0297811 100644 --- a/test/questions.js +++ b/test/questions.js @@ -66,6 +66,24 @@ test('check the values of the question object', (t) => { t.is(typeof questionsList, 'object'); }); +test.only('TYPES | upperCase (default)', (t) => { + const sgc = getConfig(path.join(fixtures, '.sgcrc')); + + const choicesList = choices(sgc); + + t.is(choicesList[0].value, 'Add:'); +}); + +test.only('TYPES | lowerCase', (t) => { + const sgc = getConfig(path.join(fixtures, '.sgcrc')); + + sgc.lowercaseTypes = true; + + const choicesList = choices(sgc); + + t.is(choicesList[0].value, 'add:'); +}); + test('SCOPE | check if scope is off by default', (t) => { const config = getConfig(); const questionsList = questions(config); From fa57b16333db5d2c5e077dd795a6a536ecaa339d Mon Sep 17 00:00:00 2001 From: aichbauer Date: Mon, 7 Aug 2017 19:39:04 +0200 Subject: [PATCH 2/3] Feat: lowercase types --- .sgcrc | 1 + lib/questions.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.sgcrc b/.sgcrc index 0e56346..a377158 100644 --- a/.sgcrc +++ b/.sgcrc @@ -2,6 +2,7 @@ "scope": false, "body": true, "emoji": false, + "lowercaseTypes": false, "initial-commit": { "isEnabled": true, "emoji": ":tada:", diff --git a/lib/questions.js b/lib/questions.js index 3406be0..d356471 100644 --- a/lib/questions.js +++ b/lib/questions.js @@ -7,7 +7,7 @@ const choices = (config) => { config.types.forEach((type) => { const emoji = config.emoji && type.emoji ? `${type.emoji} ` : ''; - const configType = type.type; + const configType = config.lowercaseTypes ? type.type.toLowerCase() : type.type; const description = type.description || ''; choicesList.push({ From c550806bc25f9f50f96bd4f3da49181cf8e0ecb7 Mon Sep 17 00:00:00 2001 From: aichbauer Date: Mon, 7 Aug 2017 19:40:10 +0200 Subject: [PATCH 3/3] Test: fix remove only --- test/questions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/questions.js b/test/questions.js index 0297811..12c49cb 100644 --- a/test/questions.js +++ b/test/questions.js @@ -66,7 +66,7 @@ test('check the values of the question object', (t) => { t.is(typeof questionsList, 'object'); }); -test.only('TYPES | upperCase (default)', (t) => { +test('TYPES | upperCase (default)', (t) => { const sgc = getConfig(path.join(fixtures, '.sgcrc')); const choicesList = choices(sgc); @@ -74,7 +74,7 @@ test.only('TYPES | upperCase (default)', (t) => { t.is(choicesList[0].value, 'Add:'); }); -test.only('TYPES | lowerCase', (t) => { +test('TYPES | lowerCase', (t) => { const sgc = getConfig(path.join(fixtures, '.sgcrc')); sgc.lowercaseTypes = true;