@@ -8,7 +8,11 @@ import { ChildProcess } from "../lib/wrappers/child-process";
88const JavaHomeName = "JAVA_HOME" ;
99const AndroidHomeName = "ANDROID_HOME" ;
1010const PROGRAM_FILES = "ProgramFiles" ;
11+ const PROGRAM_FILES_X86 = "ProgramFiles(x86)" ;
12+ const LOCAL_APP_DATA = "LOCALAPPDATA" ;
1113const PROGRAM_FILES_ENV_PATH = "C:\\Program Files" ;
14+ const PROGRAM_FILEX_X86_ENV_PATH = "C:\\Program Files(x86)" ;
15+ const LOCAL_APP_DATA_ENV_PATH = "C:\\username\\localappdata" ;
1216
1317interface IChildProcessResultDescription {
1418 result ?: any ;
@@ -145,7 +149,7 @@ function mockSysInfo(childProcessResult: IChildProcessResults, hostInfoOptions?:
145149 } ;
146150
147151 const fileSystem : any = {
148- exists : ( ) => Promise . resolve ( ( fileSystemOptions || { } ) . existsResult ) ,
152+ exists : ( ) => ( fileSystemOptions || { } ) . existsResult ,
149153 extractZip : ( ) => Promise . resolve ( ) ,
150154 readDirectory : ( ) => Promise . resolve ( [ ] )
151155 } ;
@@ -271,7 +275,9 @@ describe("SysInfo unit tests", () => {
271275 it ( "on Windows" , async ( ) => {
272276 const originalProgramFiles = process . env [ PROGRAM_FILES ] ;
273277 process . env [ PROGRAM_FILES ] = PROGRAM_FILES_ENV_PATH ;
274- sysInfo = mockSysInfo ( childProcessResult , { isWindows : true , isDarwin : false , dotNetVersion } ) ;
278+ process . env [ PROGRAM_FILES_X86 ] = PROGRAM_FILEX_X86_ENV_PATH ;
279+ process . env [ LOCAL_APP_DATA ] = LOCAL_APP_DATA_ENV_PATH ;
280+ sysInfo = mockSysInfo ( childProcessResult , { isWindows : true , isDarwin : false , dotNetVersion } , { existsResult : true } ) ;
275281 const result = await sysInfo . getSysInfo ( ) ;
276282 process . env [ PROGRAM_FILES ] = originalProgramFiles ;
277283 assertCommonValues ( result ) ;
@@ -517,7 +523,7 @@ ${expectedCliVersion}`;
517523 assert . deepEqual ( result . itunesInstalled , undefined ) ;
518524 assert . deepEqual ( result . cocoaPodsVer , "0.38.2" ) ;
519525 assert . deepEqual ( result . xcodeprojLocation , null ) ;
520- assert . deepEqual ( result . isCocoaPodsWorkingCorrectly , undefined ) ;
526+ assert . deepEqual ( result . isCocoaPodsWorkingCorrectly , true ) ;
521527 assert . deepEqual ( result . xcprojInfo , undefined ) ;
522528 assert . deepEqual ( result . isCocoaPodsUpdateRequired , false ) ;
523529 assert . deepEqual ( result . pythonInfo , { isInstalled : false , isSixPackageInstalled : false , installationErrorMessage : "Cannot read property 'shouldThrowError' of undefined" } ) ;
@@ -538,7 +544,7 @@ ${expectedCliVersion}`;
538544 assert . deepEqual ( result . isAndroidSdkConfiguredCorrectly , undefined ) ;
539545 } ) ;
540546 it ( "Android platform is specified" , async ( ) => {
541- sysInfo = mockSysInfo ( childProcessResult , { isWindows : false , isDarwin : true , dotNetVersion } ) ;
547+ sysInfo = mockSysInfo ( childProcessResult , { isWindows : false , isDarwin : true , dotNetVersion } , { existsResult : true } ) ;
542548 const result = await sysInfo . getSysInfo ( { platform : "Android" } ) ;
543549
544550 assertCommonSysInfo ( result ) ;
@@ -552,7 +558,6 @@ ${expectedCliVersion}`;
552558 assert . deepEqual ( result . xcprojInfo , undefined ) ;
553559 assert . deepEqual ( result . isCocoaPodsUpdateRequired , undefined ) ;
554560 assert . deepEqual ( result . pythonInfo , undefined ) ;
555-
556561 } ) ;
557562 it ( "no platform is specified" , async ( ) => {
558563 sysInfo = mockSysInfo ( childProcessResult , { isWindows : false , isDarwin : true , dotNetVersion } ) ;
0 commit comments