@@ -38,8 +38,12 @@ describe('Config Loading & Error Messaging', () => {
3838 ( ConfigUtils . loadConfig as any ) . mockResolvedValue ( { } ) ;
3939
4040 await command . init ( ) ;
41+ // project root finding happens in init, verification happens in runInit
42+ // but this test marks requiresProject=true, so if we don't call runInit, we only verify init logic.
43+ // The original test verified init logic calling loadConfig.
4144
4245 expect ( ConfigUtils . findProjectRoot ) . toHaveBeenCalledWith ( 'astrical' , expect . any ( String ) ) ;
46+ // loadConfig is called in init if root is found
4347 expect ( ConfigUtils . loadConfig ) . toHaveBeenCalledWith ( 'astrical' , '/some/path' ) ;
4448 } ) ;
4549
@@ -50,6 +54,7 @@ describe('Config Loading & Error Messaging', () => {
5054 ( ConfigUtils . findProjectRoot as any ) . mockResolvedValue ( null ) ;
5155
5256 await command . init ( ) ;
57+ await command . runInit ( { } ) ;
5358
5459 expect ( consoleLogSpy ) . toHaveBeenCalledWith (
5560 expect . stringContaining ( pc . red ( '✖ This command requires to be run within an app project (astrical.yml not found).' ) )
@@ -64,6 +69,7 @@ describe('Config Loading & Error Messaging', () => {
6469 ( ConfigUtils . findProjectRoot as any ) . mockResolvedValue ( null ) ;
6570
6671 await command . init ( ) ;
72+ await command . runInit ( { } ) ;
6773
6874 expect ( consoleLogSpy ) . toHaveBeenCalledWith (
6975 expect . stringContaining ( pc . red ( '✖ This command requires to be run within an app project (app.yml not found).' ) )
0 commit comments