@@ -164,10 +164,24 @@ describe('Content types', () => {
164164 . it ( 'should prompt and ask confirmation' , async ( ) => {
165165 sinon . replace ( cliux , 'confirm' , async ( ) => false ) ;
166166 const ctInstance = new ContentType ( { ...constructorParam , fix : true } ) ;
167+ ( ctInstance as any ) . schema = constructorParam . ctSchema ?. length ? [ constructorParam . ctSchema [ 0 ] ] : [ { uid : 'ct1' , title : 'T' } as ContentTypeStruct ] ;
167168 const spy = sinon . spy ( cliux , 'confirm' ) ;
168169 await ctInstance . writeFixContent ( ) ;
169170 expect ( spy . callCount ) . to . be . equals ( 1 ) ;
170171 } ) ;
172+
173+ fancy
174+ . stdout ( { print : process . env . PRINT === 'true' || false } )
175+ . stub ( fs , 'writeFileSync' , ( ) => { } )
176+ . it ( 'should not prompt or write when schema is empty in fix mode' , async ( ) => {
177+ const ctInstance = new ContentType ( { ...constructorParam , fix : true } ) ;
178+ ( ctInstance as any ) . schema = [ ] ;
179+ const confirmSpy = sinon . spy ( cliux , 'confirm' ) ;
180+ const fsSpy = sinon . spy ( fs , 'writeFileSync' ) ;
181+ await ctInstance . writeFixContent ( ) ;
182+ expect ( confirmSpy . callCount ) . to . be . equals ( 0 ) ;
183+ expect ( fsSpy . callCount ) . to . be . equals ( 0 ) ;
184+ } ) ;
171185 } ) ;
172186
173187 describe ( 'lookForReference method' , ( ) => {
0 commit comments