@@ -63,7 +63,7 @@ describe('Export Config Handler', () => {
6363 expect ( askExportDirStub . called ) . to . be . false ;
6464 } ) ;
6565
66- it ( 'should print yellow warning when data-dir is set and export directory is not empty' , async ( ) => {
66+ it ( 'should print yellow warning when export directory is not empty (data-dir flag) ' , async ( ) => {
6767 configHandlerGetStub . withArgs ( 'authorisationType' ) . returns ( 'OAUTH' ) ;
6868 const isNonEmptyStub = sandbox . stub ( fileHelper , 'isDirectoryNonEmpty' ) . returns ( true ) ;
6969 const cliuxPrint = utilities . cliux . print as sinon . SinonStub ;
@@ -81,6 +81,24 @@ describe('Export Config Handler', () => {
8181 ) . to . be . true ;
8282 } ) ;
8383
84+ it ( 'should print yellow warning when export directory is not empty (interactive path)' , async ( ) => {
85+ configHandlerGetStub . withArgs ( 'authorisationType' ) . returns ( 'OAUTH' ) ;
86+ const isNonEmptyStub = sandbox . stub ( fileHelper , 'isDirectoryNonEmpty' ) . returns ( true ) ;
87+ const cliuxPrint = utilities . cliux . print as sinon . SinonStub ;
88+ cliuxPrint . resetHistory ( ) ;
89+
90+ const flags = { } ;
91+ await setupConfig ( flags ) ;
92+
93+ expect ( isNonEmptyStub . calledWith ( path . resolve ( '/default/export/dir' ) ) ) . to . be . true ;
94+ expect (
95+ cliuxPrint . calledWith (
96+ '\nThe export directory is not empty. Existing files in this folder may be overwritten.' ,
97+ { color : 'yellow' } ,
98+ ) ,
99+ ) . to . be . true ;
100+ } ) ;
101+
84102 it ( 'should ask for export directory when not provided' , async ( ) => {
85103 // Set authenticated: isAuthenticated() checks configHandler.get('authorisationType')
86104 // Returns 'OAUTH' or 'AUTH' for authenticated, undefined for not authenticated
0 commit comments