Skip to content

Commit efb4e00

Browse files
committed
Fix checkEnvironmentRequirements tests and rename IValidateOutput to IValidatePlatformOutput
1 parent ec4d21c commit efb4e00

File tree

8 files changed

+17
-14
lines changed

8 files changed

+17
-14
lines changed

lib/definitions/livesync.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ interface ILiveSyncCommandHelper {
543543
* @param {string} platform The platform to be validated.
544544
* @return {Promise<void>}
545545
*/
546-
validatePlatform(platform: string): Promise<IDictionary<IValidateOutput>>;
546+
validatePlatform(platform: string): Promise<IDictionary<IValidatePlatformOutput>>;
547547

548548
/**
549549
* Executes livesync operation. Meant to be called from within a command.

lib/definitions/project.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ interface ICleanNativeAppData extends IProjectDir, IPlatform { }
319319

320320
interface IPlatformProjectService extends NodeJS.EventEmitter, IPlatformProjectServiceBase {
321321
getPlatformData(projectData: IProjectData): IPlatformData;
322-
validate(projectData: IProjectData): Promise<IValidateOutput>;
322+
validate(projectData: IProjectData): Promise<IValidatePlatformOutput>;
323323
createProject(frameworkDir: string, frameworkVersion: string, projectData: IProjectData, config: ICreateProjectOptions): Promise<void>;
324324
interpolateData(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
325325
interpolateConfigurationFile(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): void;
@@ -438,7 +438,7 @@ interface IPlatformProjectService extends NodeJS.EventEmitter, IPlatformProjectS
438438
checkIfPluginsNeedBuild(projectData: IProjectData): Promise<Array<any>>;
439439
}
440440

441-
interface IValidateOutput {
441+
interface IValidatePlatformOutput {
442442
checkEnvironmentRequirementsOutput: ICheckEnvironmentRequirementsOutput;
443443
}
444444

lib/helpers/livesync-command-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
127127
await this.$liveSyncService.liveSync(deviceDescriptors, liveSyncInfo);
128128
}
129129

130-
public async validatePlatform(platform: string): Promise<IDictionary<IValidateOutput>> {
131-
const result: IDictionary<IValidateOutput> = {};
130+
public async validatePlatform(platform: string): Promise<IDictionary<IValidatePlatformOutput>> {
131+
const result: IDictionary<IValidatePlatformOutput> = {};
132132

133133
const availablePlatforms = this.getPlatformsForOperation(platform);
134134
for (const availablePlatform of availablePlatforms) {

lib/services/android-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
118118
}
119119
}
120120

121-
public async validate(projectData: IProjectData): Promise<IValidateOutput> {
121+
public async validate(projectData: IProjectData): Promise<IValidatePlatformOutput> {
122122
this.validatePackageName(projectData.projectId);
123123
this.validateProjectName(projectData.projectName);
124124

lib/services/ios-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
133133
return path.join(this.getPlatformData(projectData).projectRoot, projectData.projectName, "Resources");
134134
}
135135

136-
public async validate(projectData: IProjectData): Promise<IValidateOutput> {
136+
public async validate(projectData: IProjectData): Promise<IValidatePlatformOutput> {
137137
if (!this.$hostInfo.isDarwin) {
138138
return;
139139
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"ora": "2.0.0",
6060
"osenv": "0.1.3",
6161
"pacote": "8.1.6",
62-
"pako": "^1.0.6",
62+
"pako": "1.0.6",
6363
"pbxproj-dom": "1.0.11",
6464
"plist": "1.1.0",
6565
"plist-merge-patch": "0.1.1",

test/services/platform-environment-requirements.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe("platformEnvironmentRequirements ", () => {
8484
it("should return true when environment is configured", async () => {
8585
mockDoctorService({ canExecuteLocalBuild: true });
8686
const result = await platformEnvironmentRequirements.checkEnvironmentRequirements(platform);
87-
assert.isTrue(result);
87+
assert.isTrue(result.canExecute);
8888
assert.isTrue(promptForChoiceData.length === 0);
8989
});
9090
it("should show prompt when environment is not configured and nativescript-cloud extension is not installed", async () => {
@@ -108,10 +108,12 @@ describe("platformEnvironmentRequirements ", () => {
108108
assert.deepEqual("To continue, choose one of the following options: ", promptForChoiceData[0].message);
109109
assert.deepEqual(['Sync to Playground', 'Try Cloud Operation', 'Configure for Local Builds', 'Skip Step and Configure Manually'], promptForChoiceData[0].choices);
110110
});
111-
it("should skip env chech when NS_SKIP_ENV_CHECK environment variable is passed", async() => {
111+
it("should skip env check when NS_SKIP_ENV_CHECK environment variable is passed", async() => {
112112
process.env.NS_SKIP_ENV_CHECK = true;
113113

114-
assert.isTrue(await platformEnvironmentRequirements.checkEnvironmentRequirements(platform));
114+
const output = await platformEnvironmentRequirements.checkEnvironmentRequirements(platform);
115+
116+
assert.isTrue(output.canExecute);
115117
assert.isFalse(isExtensionInstallCalled);
116118
assert.isTrue(promptForChoiceData.length === 0);
117119
});
@@ -128,7 +130,8 @@ describe("platformEnvironmentRequirements ", () => {
128130

129131
mockNativeScriptCloudExtensionService({ isInstalled: null });
130132

131-
assert.isTrue(await platformEnvironmentRequirements.checkEnvironmentRequirements(platform));
133+
const output = await platformEnvironmentRequirements.checkEnvironmentRequirements(platform);
134+
assert.isTrue(output.canExecute);
132135
});
133136

134137
describe("and env is not configured after executing setup script", () => {

test/stubs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ export class PlatformProjectServiceStub extends EventEmitter implements IPlatfor
331331
validateOptions(): Promise<boolean> {
332332
return Promise.resolve(true);
333333
}
334-
validate(): Promise<IValidateOutput> {
335-
return Promise.resolve(<IValidateOutput>{});
334+
validate(): Promise<IValidatePlatformOutput> {
335+
return Promise.resolve(<IValidatePlatformOutput>{});
336336
}
337337
validatePlugins(projectData: IProjectData) {
338338
return Promise.resolve();

0 commit comments

Comments
 (0)