@@ -70,24 +70,6 @@ describe("Config.Connection paths", () => {
7070 ): Platform .t
7171 )
7272
73- // Mock platform with download capability for testing download actions
74- let platformWithMockDownload = (
75- module (
76- {
77- include Desktop .Desktop
78- let findCommand = (_command , ~timeout as _timeout = 1000 ) => {
79- Promise .resolve (Ok (systemAgda .contents ))
80- }
81- let determinePlatform = async () => Ok (Connection__Download__Platform .MacOS_Arm )
82- let alreadyDownloaded = _globalStorageUri => async () => None
83-
84- let downloadLatestALS = (_logChannel , _memento , _globalStorageUri ) => _platform => {
85- Promise .resolve (Ok (downloadedALS .contents ))
86- }
87- }
88- ): Platform .t
89- )
90-
9173 // Helper function to create a connection with given config paths
9274 // also returns a Log listener to capture config changes
9375 let makeConnection = async (configPaths : array <string >, platform : Platform .t ) => {
@@ -350,7 +332,11 @@ describe("Config.Connection paths", () => {
350332 detail : "ALS v0.2.10, Agda v2.7.0.1" ,
351333 }
352334
353- await executeUITest (mockState , platformWithMockDownload , mockSelectedItem )
335+ await executeUITest (
336+ mockState ,
337+ Mock .Platform .makeWithSuccessfulDownload (downloadedALS .contents ),
338+ mockSelectedItem ,
339+ )
354340 let logs = listener (~filter = Log .isConfig )
355341 let finalConfig = Config .Connection .getAgdaPaths ()
356342 (logs , finalConfig )
@@ -408,7 +394,6 @@ describe("Config.Connection paths", () => {
408394 }
409395 }
410396
411-
412397 describe (
413398 "Switch version UI selection" ,
414399 () => {
@@ -418,7 +403,11 @@ describe("Config.Connection paths", () => {
418403 let initialConfig = [userAgda .contents ]
419404 let selectedPath = alternativeAgda .contents // not in initial config
420405
421- let (logs , finalConfig ) = await UITestBuilders .simulatePathSelection (initialConfig , selectedPath , ~description = "" )
406+ let (logs , finalConfig ) = await UITestBuilders .simulatePathSelection (
407+ initialConfig ,
408+ selectedPath ,
409+ ~description = "" ,
410+ )
422411
423412 // Should add the selected path to config
424413 let expectedConfig = Array .concat (initialConfig , [selectedPath ])
@@ -451,7 +440,11 @@ describe("Config.Connection paths", () => {
451440 let initialConfig = [userAgda .contents ]
452441 let selectedPath = alternativeAgda .contents
453442
454- let (logs , finalConfig ) = await UITestBuilders .simulatePathSelection (initialConfig , selectedPath , ~description = "" )
443+ let (logs , finalConfig ) = await UITestBuilders .simulatePathSelection (
444+ initialConfig ,
445+ selectedPath ,
446+ ~description = "" ,
447+ )
455448
456449 // Should add the new path to existing config
457450 let expectedConfig = Array .concat (initialConfig , [selectedPath ])
@@ -475,15 +468,15 @@ describe("Config.Connection paths", () => {
475468 ~isAlreadyDownloaded = false ,
476469 )
477470
478- // Download action should not modify config in test environment
479- // (real downloads would modify config, but test environment doesn't have download capability )
480- Assert .deepStrictEqual (logs , [])
481- Assert .deepStrictEqual (finalConfig , initialConfig )
471+ // Should add the downloaded ALS path to config
472+ let expectedConfig = Array . concat ( initialConfig , [ downloadedALS . contents ] )
473+ Assert .deepStrictEqual (logs , [Log . Config ( Changed ( initialConfig , expectedConfig )) ])
474+ Assert .deepStrictEqual (finalConfig , expectedConfig )
482475 },
483476 )
484477
485478 Async .it (
486- "should show already downloaded message when user selects already downloaded ALS" ,
479+ "should add already downloaded path to config when user selects already downloaded ALS" ,
487480 async () => {
488481 let initialConfig = [userAgda .contents ]
489482
@@ -492,10 +485,10 @@ describe("Config.Connection paths", () => {
492485 ~isAlreadyDownloaded = true ,
493486 )
494487
495- // Download action should not modify config in test environment
496- // (shows message but doesn't download or modify config )
497- Assert .deepStrictEqual (logs , [])
498- Assert .deepStrictEqual (finalConfig , initialConfig )
488+ // Should add the already downloaded ALS path to config
489+ let expectedConfig = Array . concat ( initialConfig , [ downloadedALS . contents ] )
490+ Assert .deepStrictEqual (logs , [Log . Config ( Changed ( initialConfig , expectedConfig )) ])
491+ Assert .deepStrictEqual (finalConfig , expectedConfig )
499492 },
500493 )
501494 },
0 commit comments