Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit fe90097

Browse files
authored
[Tests] Fix server response (#1781)
1 parent abd6278 commit fe90097

File tree

3 files changed

+301
-293
lines changed

3 files changed

+301
-293
lines changed

code-push-plugin-testing-framework/script/serverUtil.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,17 @@ exports.UpdateCheckRequestMock = UpdateCheckRequestMock;
8383
*/
8484
function createDefaultResponse() {
8585
var defaultResponse = new CheckForUpdateResponseMock();
86-
defaultResponse.downloadURL = "";
86+
defaultResponse.download_url = "";
87+
defaultResponse.is_disabled = false;
8788
defaultResponse.description = "";
88-
defaultResponse.isAvailable = false;
89-
defaultResponse.isMandatory = false;
90-
defaultResponse.appVersion = "";
91-
defaultResponse.packageHash = "";
89+
defaultResponse.is_available = false;
90+
defaultResponse.is_mandatory = false;
91+
defaultResponse.target_binary_range = "";
92+
defaultResponse.package_hash = "";
9293
defaultResponse.label = "";
93-
defaultResponse.packageSize = 0;
94-
defaultResponse.updateAppVersion = false;
94+
defaultResponse.package_size = 0;
95+
defaultResponse.should_run_binary_version = false;
96+
defaultResponse.update_app_version = false;
9597
return defaultResponse;
9698
}
9799
exports.createDefaultResponse = createDefaultResponse;
@@ -102,19 +104,21 @@ function createUpdateResponse(mandatory, targetPlatform, randomHash) {
102104
if (mandatory === void 0) { mandatory = false; }
103105
if (randomHash === void 0) { randomHash = true; }
104106
var updateResponse = new CheckForUpdateResponseMock();
105-
updateResponse.isAvailable = true;
106-
updateResponse.appVersion = "1.0.0";
107-
updateResponse.downloadURL = "mock.url/download";
108-
updateResponse.isMandatory = mandatory;
107+
updateResponse.is_available = true;
108+
updateResponse.is_disabled = false;
109+
updateResponse.target_binary_range = "1.0.0";
110+
updateResponse.download_url = "mock.url/v0.1/public/codepush/report_status/download";
111+
updateResponse.is_mandatory = mandatory;
109112
updateResponse.label = "mock-update";
110-
updateResponse.packageHash = "12345-67890";
111-
updateResponse.packageSize = 12345;
112-
updateResponse.updateAppVersion = false;
113+
updateResponse.package_hash = "12345-67890";
114+
updateResponse.package_size = 12345;
115+
updateResponse.should_run_binary_version = false;
116+
updateResponse.update_app_version = false;
113117
if (!!targetPlatform)
114-
updateResponse.downloadURL = targetPlatform.getServerUrl() + "/download";
118+
updateResponse.download_url = targetPlatform.getServerUrl() + "/v0.1/public/codepush/report_status/download";
115119
// We need unique hashes to avoid conflicts.
116120
if (randomHash) {
117-
updateResponse.packageHash = "randomHash-" + Math.floor(Math.random() * 10000);
121+
updateResponse.package_hash = "randomHash-" + Math.floor(Math.random() * 10000);
118122
}
119123
return updateResponse;
120124
}

code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,17 @@ declare module 'code-push-plugin-testing-framework/script/serverUtil' {
298298
* Class used to mock the codePush.checkForUpdate() response from the server.
299299
*/
300300
export class CheckForUpdateResponseMock {
301-
downloadURL: string;
302-
isAvailable: boolean;
303-
packageSize: number;
304-
updateAppVersion: boolean;
305-
appVersion: string;
306-
description: string;
307-
label: string;
308-
packageHash: string;
309-
isMandatory: boolean;
301+
download_url: string;
302+
is_available: boolean;
303+
should_run_binary_version: boolean;
304+
package_size: number;
305+
update_app_version: boolean;
306+
target_binary_range: string;
307+
is_disabled: boolean;
308+
description: string;
309+
label: string;
310+
package_hash: string;
311+
is_mandatory: boolean;
310312
}
311313
/**
312314
* The model class of the codePush.checkForUpdate() request to the server.

0 commit comments

Comments
 (0)