@@ -183,11 +183,12 @@ describe('ConfigReader Tests', () => {
183183 const pathUsed = readFileSpy . firstCall . args [ 0 ] ;
184184
185185 assert . ok (
186- pathUsed . includes ( 'AppData' ) &&
187- pathUsed . includes ( 'Roaming' ) &&
186+ pathUsed . includes ( 'AppData' ) &&
187+ pathUsed . includes ( 'Roaming' ) &&
188188 pathUsed . includes ( 'Block' ) &&
189189 pathUsed . includes ( 'goose' ) &&
190- pathUsed . includes ( 'config' )
190+ pathUsed . includes ( 'config' ) &&
191+ pathUsed . endsWith ( 'config.yaml' )
191192 ) ;
192193
193194 // Restore environment
@@ -197,4 +198,43 @@ describe('ConfigReader Tests', () => {
197198 delete process . env . APPDATA ;
198199 }
199200 } ) ;
201+
202+ it ( 'should fallback to Roaming when APPDATA is undefined' , ( ) => {
203+ const readFileSpy = sinon . spy ( ) ;
204+
205+ const mockWinOs : OS = {
206+ homedir : ( ) => 'C:\\Users\\test' ,
207+ platform : ( ) => 'win32'
208+ } ;
209+
210+ const mockWinFs : FileSystem = {
211+ existsSync : ( ) => true ,
212+ readFileSync : ( path ) => {
213+ readFileSpy ( path ) ;
214+ return 'GOOSE_PROVIDER: "databricks"\nGOOSE_MODEL: "claude-3-7-sonnet"' ;
215+ }
216+ } ;
217+
218+ // Ensure APPDATA is undefined
219+ const originalAppData = process . env . APPDATA ;
220+ delete process . env . APPDATA ;
221+
222+ readGooseConfig ( mockWinFs , mockWinOs ) ;
223+
224+ sinon . assert . calledOnce ( readFileSpy ) ;
225+ const pathUsed = readFileSpy . firstCall . args [ 0 ] ;
226+
227+ assert . ok (
228+ pathUsed . includes ( 'AppData' ) &&
229+ pathUsed . includes ( 'Roaming' ) &&
230+ pathUsed . includes ( 'Block' ) &&
231+ pathUsed . includes ( 'goose' ) &&
232+ pathUsed . includes ( 'config' ) &&
233+ pathUsed . endsWith ( 'config.yaml' )
234+ ) ;
235+
236+ if ( originalAppData ) {
237+ process . env . APPDATA = originalAppData ;
238+ }
239+ } ) ;
200240} ) ;
0 commit comments