@@ -11,43 +11,40 @@ test('get configuration file equals .sgcrc_default', (t) => {
1111 t . deepEqual ( getConfig ( ) , json . readToObjSync ( path . join ( cwd , '.sgcrc_default' ) ) ) ;
1212} ) ;
1313
14- test ( 'choices are the same as choices generated from .sgcrc_default' , ( t ) => {
15- const sgc = getConfig ( ) ;
16- const configuration = getConfig ( ) ;
17- const choicesList = choices ( configuration ) ;
14+ test ( 'choices are the same as choices generated from .sgcrc_default' , async ( t ) => {
15+ const sgc = await getConfig ( ) ;
16+ const choicesList = await choices ( sgc ) ;
1817 const choicesArray = [ ] ;
1918
20- Promise . resolve ( ( ) => {
21- sgc . types . forEach ( ( type ) => {
22- const emoji = `${ type . emoji } ` || '' ;
23- const configType = type . type ;
24- const description = type . description || '' ;
25-
26- choicesArray . push ( {
27- value : emoji + configType ,
28- name : `${ chalk . bold ( configType ) } ${ description } ` ,
29- } ) ;
30- } ) . then ( ( ) => {
31- t . deepEqual ( choicesList , choicesArray ) ;
19+ sgc . types . forEach ( ( type ) => {
20+ const emoji = `${ type . emoji } ` || '' ;
21+ const configType = type . type ;
22+ const description = type . description || '' ;
23+
24+ choicesArray . push ( {
25+ value : emoji + configType ,
26+ name : `${ chalk . bold ( configType ) } ${ description } ` ,
3227 } ) ;
3328 } ) ;
29+
30+ t . deepEqual ( choicesList , await choicesArray ) ;
3431} ) ;
3532
36- test ( 'check the values of the question object' , ( t ) => {
37- const configuration = getConfig ( ) ;
38- const choicesList = choices ( configuration ) ;
39- const questionsList = questions ( choicesList ) ;
33+ test ( 'check the values of the question object' , async ( t ) => {
34+ const configuration = await getConfig ( ) ;
35+ const choicesList = await choices ( configuration ) ;
36+ const questionsList = await questions ( choicesList , configuration ) ;
4037
4138 t . deepEqual ( typeof questionsList , 'object' ) ;
4239} ) ;
4340
44- test ( 'validate functions in questions' , ( t ) => {
45- const configuration = getConfig ( ) ;
46- const choicesList = choices ( configuration ) ;
47- const questionsList = questions ( choicesList ) ;
41+ test ( 'validate functions in questions' , async ( t ) => {
42+ const configuration = await getConfig ( ) ;
43+ const choicesList = await choices ( configuration ) ;
44+ const questionsList = await questions ( choicesList , configuration ) ;
4845
4946 t . deepEqual ( questionsList [ 1 ] . validate ( 'input text' ) , true ) ;
50- t . deepEqual ( questionsList [ 1 ] . validate ( ) , 'A commit message is mandatory! ' ) ;
47+ t . deepEqual ( questionsList [ 1 ] . validate ( 'This message has over 72 characters. So this test will definitely fail. I can guarantee that I am telling the truth' ) , 'The commit message is not allowed to be longer as 72. Consider writing a body.\n ' ) ;
5148} ) ;
5249
5350test ( 'when and default functions in questions' , ( t ) => {
0 commit comments