Skip to content

Commit 04dcc8a

Browse files
committed
Fix tests
1 parent 0a29cc7 commit 04dcc8a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/sys-info.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import { ChildProcess } from "../lib/wrappers/child-process";
88
const JavaHomeName = "JAVA_HOME";
99
const AndroidHomeName = "ANDROID_HOME";
1010
const PROGRAM_FILES = "ProgramFiles";
11+
const PROGRAM_FILES_X86 = "ProgramFiles(x86)";
12+
const LOCAL_APP_DATA = "LOCALAPPDATA";
1113
const 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

1317
interface 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);

0 commit comments

Comments
 (0)