@@ -178,4 +178,56 @@ describe('Config service', () => {
178178 expect ( webdavConfigResult ) . to . be . deep . equal ( defaultWebdavConfig ) ;
179179 expect ( fsStub ) . toHaveBeenCalledWith ( ConfigService . WEBDAV_CONFIGS_FILE , 'utf8' ) ;
180180 } ) ;
181+
182+ it ( 'should default to true when webdav config exists but createFullPath property is missing' , async ( ) => {
183+ const partialWebdavConfig = {
184+ host : '192.168.1.1' ,
185+ port : '8080' ,
186+ protocol : 'https' ,
187+ timeoutMinutes : 30 ,
188+ } ;
189+ const stringConfig = JSON . stringify ( partialWebdavConfig ) ;
190+
191+ const fsStub = vi . spyOn ( fs , 'readFile' ) . mockResolvedValue ( stringConfig ) ;
192+
193+ const webdavConfigResult = await ConfigService . instance . readWebdavConfig ( ) ;
194+ expect ( webdavConfigResult . createFullPath ) . to . be . equal ( true ) ;
195+ expect ( webdavConfigResult . host ) . to . be . equal ( partialWebdavConfig . host ) ;
196+ expect ( webdavConfigResult . port ) . to . be . equal ( partialWebdavConfig . port ) ;
197+ expect ( fsStub ) . toHaveBeenCalledWith ( ConfigService . WEBDAV_CONFIGS_FILE , 'utf8' ) ;
198+ } ) ;
199+
200+ it ( 'shoud return false when webdav config has createFullPath explicitly set to false' , async ( ) => {
201+ const webdavConfig = {
202+ host : '192.168.1.1' ,
203+ port : '8080' ,
204+ protocol : 'https' ,
205+ timeoutMinutes : 30 ,
206+ createFullPath : false ,
207+ } ;
208+ const stringConfig = JSON . stringify ( webdavConfig ) ;
209+
210+ const fsStub = vi . spyOn ( fs , 'readFile' ) . mockResolvedValue ( stringConfig ) ;
211+
212+ const webdavConfigResult = await ConfigService . instance . readWebdavConfig ( ) ;
213+ expect ( webdavConfigResult . createFullPath ) . to . be . equal ( false ) ;
214+ expect ( fsStub ) . toHaveBeenCalledWith ( ConfigService . WEBDAV_CONFIGS_FILE , 'utf8' ) ;
215+ } ) ;
216+
217+ it ( 'should return true when webdav config has createFullPath explicitly set to true' , async ( ) => {
218+ const webdavConfig = {
219+ host : '192.168.1.1' ,
220+ port : '8080' ,
221+ protocol : 'https' ,
222+ timeoutMinutes : 30 ,
223+ createFullPath : true ,
224+ } ;
225+ const stringConfig = JSON . stringify ( webdavConfig ) ;
226+
227+ const fsStub = vi . spyOn ( fs , 'readFile' ) . mockResolvedValue ( stringConfig ) ;
228+
229+ const webdavConfigResult = await ConfigService . instance . readWebdavConfig ( ) ;
230+ expect ( webdavConfigResult . createFullPath ) . to . be . equal ( true ) ;
231+ expect ( fsStub ) . toHaveBeenCalledWith ( ConfigService . WEBDAV_CONFIGS_FILE , 'utf8' ) ;
232+ } ) ;
181233} ) ;
0 commit comments