@@ -31,6 +31,7 @@ describe('AuditBaseCommand class', () => {
31
31
32
32
class AuditFixCMD extends AuditBaseCommand {
33
33
async run ( ) {
34
+ await this . init ( ) ;
34
35
await this . start ( 'cm:stacks:audit:fix' ) ;
35
36
}
36
37
}
@@ -40,11 +41,11 @@ describe('AuditBaseCommand class', () => {
40
41
} as FileTransportInstance ;
41
42
42
43
const createMockWinstonLogger = ( ) => ( {
43
- log : ( message : string ) => console . log ( message ) ,
44
- error : ( message : string ) => console . error ( `ERROR: ${ message } ` ) ,
45
- info : ( message : string ) => console . info ( `INFO: ${ message } ` ) ,
46
- warn : ( message : string ) => console . warn ( `WARN: ${ message } ` ) ,
47
- debug : ( message : string ) => console . debug ( `DEBUG: ${ message } ` ) ,
44
+ log : ( message : string ) => process . stdout . write ( message + '\n' ) ,
45
+ error : ( message : string ) => process . stdout . write ( `ERROR: ${ message } \n ` ) ,
46
+ info : ( message : string ) => process . stdout . write ( `INFO: ${ message } \n ` ) ,
47
+ warn : ( message : string ) => process . stdout . write ( `WARN: ${ message } \n ` ) ,
48
+ debug : ( message : string ) => process . stdout . write ( `DEBUG: ${ message } \n ` ) ,
48
49
level : 'info'
49
50
} ) ;
50
51
@@ -144,22 +145,29 @@ describe('AuditBaseCommand class', () => {
144
145
. stub ( AuditBaseCommand . prototype , 'showOutputOnScreenWorkflowsAndExtension' , ( ) => { } )
145
146
. stub ( ux . action , 'stop' , ( ) => { } )
146
147
. stub ( ux . action , 'start' , ( ) => { } )
147
- . stub ( Entries . prototype , 'run' , ( ) => ( {
148
- entry_1 : {
149
- name : 'T1' ,
150
- display_name : 'T1' ,
151
- data_type : 'reference' ,
152
- missingRefs : [ 'gf_0' ] ,
153
- treeStr : 'T1 -> gf_0' ,
148
+ . stub ( AuditBaseCommand . prototype , 'scanAndFix' , ( ) => ( {
149
+ missingCtRefs : { ct_1 : { } } ,
150
+ missingGfRefs : { gf_1 : { } } ,
151
+ missingEntryRefs : {
152
+ entry_1 : {
153
+ name : 'T1' ,
154
+ display_name : 'T1' ,
155
+ data_type : 'reference' ,
156
+ missingRefs : [ 'gf_0' ] ,
157
+ treeStr : 'T1 -> gf_0' ,
158
+ } ,
154
159
} ,
160
+ missingCtRefsInExtensions : { } ,
161
+ missingCtRefsInWorkflow : { } ,
162
+ missingSelectFeild : { } ,
163
+ missingMandatoryFields : { } ,
164
+ missingTitleFields : { } ,
165
+ missingRefInCustomRoles : { } ,
166
+ missingEnvLocalesInAssets : { } ,
167
+ missingEnvLocalesInEntries : { } ,
168
+ missingFieldRules : { } ,
169
+ missingMultipleFields : { }
155
170
} ) )
156
- . stub ( ContentType . prototype , 'run' , ( ) => ( { ct_1 : { } } ) )
157
- . stub ( GlobalField . prototype , 'run' , ( ) => ( { gf_1 : { } } ) )
158
- . stub ( Workflows . prototype , 'run' , ( ) => ( { wf_1 : { } } ) )
159
- . stub ( Extensions . prototype , 'run' , ( ) => ( { ext_1 : { } } ) )
160
- . stub ( CustomRoles . prototype , 'run' , ( ) => ( { ext_1 : { } } ) )
161
- . stub ( Assets . prototype , 'run' , ( ) => ( { ext_1 : { } } ) )
162
- . stub ( FieldRule . prototype , 'run' , ( ) => ( { ext_1 : { } } ) )
163
171
. stub ( fs , 'createBackUp' , ( ) => { } )
164
172
. stub ( fs , 'createWriteStream' , ( ) => new PassThrough ( ) )
165
173
. stub ( AuditBaseCommand . prototype , 'createBackUp' , ( ) => { } )
0 commit comments