提交 e753c461 编写于 作者: I inter515

方法长度修改

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 788806f7
...@@ -39,13 +39,14 @@ describe('ActsBmsAccessTokenTest', function () { ...@@ -39,13 +39,14 @@ describe('ActsBmsAccessTokenTest', function () {
installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent); installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) { async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID).then(applicationInfo => { await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID)
console.info('accessTokenId: ' + applicationInfo.accessTokenId); .then(applicationInfo => {
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1); console.info('accessTokenId: ' + applicationInfo.accessTokenId);
expect(applicationInfo.accessTokenId).assertLarger(0); expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
}).catch((err) => { expect(applicationInfo.accessTokenId).assertLarger(0);
expect(err).assertFail(); }).catch((err) => {
}); expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => { installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
done(); done();
...@@ -63,19 +64,20 @@ describe('ActsBmsAccessTokenTest', function () { ...@@ -63,19 +64,20 @@ describe('ActsBmsAccessTokenTest', function () {
installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent); installer.install(BUNDLE_PATH1, installParam, OnReceiveInstallEvent);
async function OnReceiveInstallEvent(err, data) { async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(bundleInfo => { await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1); .then(bundleInfo => {
expect(bundleInfo.reqPermissions.length).assertEqual(3); expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA"); expect(bundleInfo.reqPermissions.length).assertEqual(3);
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA"); expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING"); expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissionStates.length).assertEqual(3); expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1); expect(bundleInfo.reqPermissionStates.length).assertEqual(3);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1); expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(0); expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1);
}).catch((err) => { expect(bundleInfo.reqPermissionStates[2]).assertEqual(0);
expect(err).assertFail(); }).catch((err) => {
}); expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => { installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
done(); done();
...@@ -97,23 +99,24 @@ describe('ActsBmsAccessTokenTest', function () { ...@@ -97,23 +99,24 @@ describe('ActsBmsAccessTokenTest', function () {
} }
async function OnReceiveUpdateEvent(err, data) { async function OnReceiveUpdateEvent(err, data) {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(bundleInfo => { await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1); .then(bundleInfo => {
expect(bundleInfo.reqPermissions.length).assertEqual(5); expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA"); expect(bundleInfo.reqPermissions.length).assertEqual(5);
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING"); expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND"); expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW"); expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH"); expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW");
expect(bundleInfo.reqPermissionStates.length).assertEqual(5); expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1); expect(bundleInfo.reqPermissionStates.length).assertEqual(5);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(0); expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(-1); expect(bundleInfo.reqPermissionStates[1]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(0); expect(bundleInfo.reqPermissionStates[2]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(0); expect(bundleInfo.reqPermissionStates[3]).assertEqual(0);
}).catch((err) => { expect(bundleInfo.reqPermissionStates[4]).assertEqual(0);
expect(err).assertFail(); }).catch((err) => {
}); expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => { installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
done(); done();
...@@ -135,25 +138,26 @@ describe('ActsBmsAccessTokenTest', function () { ...@@ -135,25 +138,26 @@ describe('ActsBmsAccessTokenTest', function () {
} }
async function OnReceiveUpdateEvent(err, data) { async function OnReceiveUpdateEvent(err, data) {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(bundleInfo => { await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION)
expect(bundleInfo.name).assertEqual(BUNDLE_NAME1); .then(bundleInfo => {
expect(bundleInfo.reqPermissions.length).assertEqual(6); expect(bundleInfo.name).assertEqual(BUNDLE_NAME1);
expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA"); expect(bundleInfo.reqPermissions.length).assertEqual(6);
expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA"); expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA");
expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING"); expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA");
expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND"); expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING");
expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW"); expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND");
expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.USE_BLUETOOTH"); expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW");
expect(bundleInfo.reqPermissionStates.length).assertEqual(6); expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.USE_BLUETOOTH");
expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1); expect(bundleInfo.reqPermissionStates.length).assertEqual(6);
expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1); expect(bundleInfo.reqPermissionStates[0]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[2]).assertEqual(0); expect(bundleInfo.reqPermissionStates[1]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[3]).assertEqual(-1); expect(bundleInfo.reqPermissionStates[2]).assertEqual(0);
expect(bundleInfo.reqPermissionStates[4]).assertEqual(0); expect(bundleInfo.reqPermissionStates[3]).assertEqual(-1);
expect(bundleInfo.reqPermissionStates[5]).assertEqual(0); expect(bundleInfo.reqPermissionStates[4]).assertEqual(0);
}).catch((err) => { expect(bundleInfo.reqPermissionStates[5]).assertEqual(0);
expect(err).assertFail(); }).catch((err) => {
}); expect(err).assertFail();
});
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => { installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
done(); done();
...@@ -175,13 +179,14 @@ describe('ActsBmsAccessTokenTest', function () { ...@@ -175,13 +179,14 @@ describe('ActsBmsAccessTokenTest', function () {
); );
async function OnReceiveInstallEvent(err, data) { async function OnReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT).then((applicationInfo) => { await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT)
console.info("bms_AccessTokenId_0500 accessTokenId: " + applicationInfo.accessTokenId); .then((applicationInfo) => {
expect(applicationInfo.name).assertEqual(BUNDLE_NAME1); console.info("bms_AccessTokenId_0500 accessTokenId: " + applicationInfo.accessTokenId);
expect(applicationInfo.accessTokenId).assertLarger(0); expect(applicationInfo.name).assertEqual(BUNDLE_NAME1);
}).catch((err) => { expect(applicationInfo.accessTokenId).assertLarger(0);
expect(err).assertFail(); }).catch((err) => {
}); expect(err).assertFail();
});
installer.uninstall( installer.uninstall(
BUNDLE_NAME1, BUNDLE_NAME1,
installParam, installParam,
......
...@@ -44,11 +44,12 @@ describe('ActsBmsQueryAbilityByWant', function () { ...@@ -44,11 +44,12 @@ describe('ActsBmsQueryAbilityByWant', function () {
action: ['action.system.home'], action: ['action.system.home'],
entities: ['entity.system.home'], entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1 bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID).then(data => { }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
expect(data).assertFail(); USERID).then(data => {
}).catch(err => { expect(data).assertFail();
expect(err).assertEqual(1); }).catch(err => {
}); expect(err).assertEqual(1);
});
bundle.queryAbilityByWant({ bundle.queryAbilityByWant({
action: ['action.system.home'], action: ['action.system.home'],
entities: ['entity.system.home'], entities: ['entity.system.home'],
......
...@@ -96,47 +96,16 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -96,47 +96,16 @@ describe('ActsBmsHapModuleTest', function () {
if (result.hapModuleInfos.length == 2) { if (result.hapModuleInfos.length == 2) {
let hapModuleInfo = result.hapModuleInfos[0]; let hapModuleInfo = result.hapModuleInfos[0];
let hapModuleInfo1 = result.hapModuleInfos[1]; let hapModuleInfo1 = result.hapModuleInfos[1];
checkHapMoudleInfos(hapModuleInfo);
checkHapMoudleInfos(hapModuleInfo1);
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1); expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1);
expect(hapModuleInfo1.name).assertEqual(BUNDLE_NAME6); expect(hapModuleInfo1.name).assertEqual(BUNDLE_NAME6);
expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual("");
expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY);
expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.metadata.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false);
expect(hapModuleInfo1.name).assertEqual(BUNDLE_NAME6);
expect(hapModuleInfo1.moduleName).assertEqual('bmsmainabilitysecondscene'); expect(hapModuleInfo1.moduleName).assertEqual('bmsmainabilitysecondscene');
expect(hapModuleInfo1.description).assertEqual('');
expect(hapModuleInfo1.descriptionId).assertEqual(0);
expect(hapModuleInfo1.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo1.icon).assertEqual('');
expect(hapModuleInfo1.label).assertEqual('$string:app_name');
expect(hapModuleInfo1.labelId).assertEqual(0);
expect(hapModuleInfo1.iconId).assertEqual(0);
expect(hapModuleInfo1.backgroundImg).assertEqual("");
expect(hapModuleInfo1.supportedModes).assertEqual(0);
expect(hapModuleInfo1.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo1.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo1.mainAbilityName).assertEqual(SECONDMAINABILITY); expect(hapModuleInfo1.mainAbilityName).assertEqual(SECONDMAINABILITY);
expect(hapModuleInfo1.mainElementName).assertEqual(SECONDMAINABILITY); expect(hapModuleInfo1.mainElementName).assertEqual(SECONDMAINABILITY);
expect(hapModuleInfo1.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo1.colorMode).assertEqual(-1);
expect(hapModuleInfo1.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo1.metadata.length).assertEqual(0);
expect(hapModuleInfo1.installationFree).assertEqual(false);
} }
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => { installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
...@@ -156,36 +125,37 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -156,36 +125,37 @@ describe('ActsBmsHapModuleTest', function () {
installer.install(BUNDLE_PATH3, installParam, onReceiveInstallEvent); installer.install(BUNDLE_PATH3, installParam, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES).then(async (result) => { await bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
expect(result.hapModuleInfos.length).assertEqual(1); .then(async (result) => {
if (result.hapModuleInfos.length > 0) { expect(result.hapModuleInfos.length).assertEqual(1);
let hapModuleInfo = result.hapModuleInfos[0]; if (result.hapModuleInfos.length > 0) {
expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME2); let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME2);
expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.descriptionId).assertEqual(0); expect(hapModuleInfo.description).assertEqual('');
expect(hapModuleInfo.iconPath).assertEqual("$media:icon"); expect(hapModuleInfo.descriptionId).assertEqual(0);
expect(hapModuleInfo.icon).assertEqual(''); expect(hapModuleInfo.iconPath).assertEqual("$media:icon");
expect(hapModuleInfo.label).assertEqual('$string:app_name'); expect(hapModuleInfo.icon).assertEqual('');
expect(hapModuleInfo.labelId).assertEqual(0); expect(hapModuleInfo.label).assertEqual('$string:app_name');
expect(hapModuleInfo.iconId).assertEqual(0); expect(hapModuleInfo.labelId).assertEqual(0);
expect(hapModuleInfo.backgroundImg).assertEqual(""); expect(hapModuleInfo.iconId).assertEqual(0);
expect(hapModuleInfo.supportedModes).assertEqual(0); expect(hapModuleInfo.backgroundImg).assertEqual("");
expect(hapModuleInfo.reqCapabilities.length).assertEqual(0); expect(hapModuleInfo.supportedModes).assertEqual(0);
expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone'); expect(hapModuleInfo.reqCapabilities.length).assertEqual(0);
expect(hapModuleInfo.mainAbilityName).assertEqual(""); expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone');
expect(hapModuleInfo.mainElementName).assertEqual(""); expect(hapModuleInfo.mainAbilityName).assertEqual("");
expect(hapModuleInfo.abilityInfo.length).assertLarger(0); expect(hapModuleInfo.mainElementName).assertEqual("");
expect(hapModuleInfo.colorMode).assertEqual(-1); expect(hapModuleInfo.abilityInfo.length).assertLarger(0);
expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0); expect(hapModuleInfo.colorMode).assertEqual(-1);
expect(hapModuleInfo.metadata.length).assertEqual(0); expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0);
expect(hapModuleInfo.installationFree).assertEqual(false); expect(hapModuleInfo.metadata.length).assertEqual(0);
} expect(hapModuleInfo.installationFree).assertEqual(false);
installer.uninstall(BUNDLE_NAME2, installParam, (err, data) => { }
checkInstallOrUninstall(err, data); installer.uninstall(BUNDLE_NAME2, installParam, (err, data) => {
done(); checkInstallOrUninstall(err, data);
done();
});
}); });
});
} }
}); });
...@@ -313,6 +283,25 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -313,6 +283,25 @@ describe('ActsBmsHapModuleTest', function () {
} }
}); });
function checkHapMoudleInfos(info) {
expect(info.description).assertEqual('');
expect(info.descriptionId).assertEqual(0);
expect(info.iconPath).assertEqual("$media:icon");
expect(info.icon).assertEqual('');
expect(info.label).assertEqual('$string:app_name');
expect(info.labelId).assertEqual(0);
expect(info.iconId).assertEqual(0);
expect(info.backgroundImg).assertEqual("");
expect(info.supportedModes).assertEqual(0);
expect(info.reqCapabilities.length).assertEqual(0);
expect(info.deviceTypes[0]).assertEqual('phone');
expect(info.abilityInfo.length).assertLarger(0);
expect(info.colorMode).assertEqual(-1);
expect(info.extensionAbilityInfo.length).assertEqual(0);
expect(info.metadata.length).assertEqual(0);
expect(info.installationFree).assertEqual(false);
}
function checkInstallOrUninstall(err, data) { function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
......
...@@ -120,49 +120,18 @@ describe('ActsBmsJsTest', function () { ...@@ -120,49 +120,18 @@ describe('ActsBmsJsTest', function () {
let abilityInfo2 = result.abilityInfos[1]; let abilityInfo2 = result.abilityInfos[1];
let abilityInfo3 = result.abilityInfos[2]; let abilityInfo3 = result.abilityInfos[2];
let abilityInfo4 = result.abilityInfos[3]; let abilityInfo4 = result.abilityInfos[3];
expect(abilityInfo1.name).assertEqual(ABILITIY_NAME2); checkAbilityInfos(abilityInfo1);
expect(abilityInfo2.metaData.length).assertEqual(1);
expect(abilityInfo2.metaData[0].name).assertEqual("Data5B");
expect(abilityInfo2.metaData[0].value).assertEqual("float");
expect(abilityInfo2.metaData[0].extra).assertEqual("$string:mainability_description");
expect(abilityInfo2.name).assertEqual(ABILITIY_NAME3); expect(abilityInfo2.name).assertEqual(ABILITIY_NAME3);
expect(abilityInfo3.name).assertEqual(ABILITIY_NAME7); expect(abilityInfo3.name).assertEqual(ABILITIY_NAME7);
expect(abilityInfo4.name).assertEqual(ABILITIY_NAME8); expect(abilityInfo4.name).assertEqual(ABILITIY_NAME8);
expect(abilityInfo1.srcLanguage).assertEqual('js');
expect(abilityInfo1.srcPath).assertEqual('');
expect(abilityInfo1.label).assertEqual("$string:app_name");
expect(abilityInfo1.description).assertEqual("$string:mainability_description");
expect(abilityInfo1.icon).assertEqual("$media:icon");
expect(abilityInfo1.isVisible).assertEqual(true);
expect(abilityInfo1.permissions.length).assertEqual(0);
expect(abilityInfo1.deviceTypes[0]).assertEqual('phone');
expect(abilityInfo1.process).assertEqual("");
expect(abilityInfo1.uri).assertEqual("");
expect(abilityInfo1.bundleName).assertEqual(BUNDLE_NAME3);
expect(abilityInfo1.moduleName).assertEqual("entry");
expect(Object.keys(abilityInfo1.applicationInfo).length).assertLarger(0);
expect(abilityInfo1.type).assertEqual(1);
expect(abilityInfo3.type).assertEqual(2); expect(abilityInfo3.type).assertEqual(2);
expect(abilityInfo4.type).assertEqual(2); expect(abilityInfo4.type).assertEqual(2);
expect(abilityInfo1.orientation).assertEqual(0);
expect(abilityInfo1.launchMode).assertEqual(1);
expect(abilityInfo1.backgroundModes).assertEqual(0);
expect(abilityInfo3.backgroundModes).assertEqual(511); expect(abilityInfo3.backgroundModes).assertEqual(511);
expect(abilityInfo4.backgroundModes).assertEqual(129); expect(abilityInfo4.backgroundModes).assertEqual(129);
expect(abilityInfo1.descriptionId).assertLarger(0);
expect(abilityInfo1.formEnabled).assertEqual(false);
expect(abilityInfo1.iconId).assertLarger(0);
expect(abilityInfo1.labelId).assertLarger(0);
expect(abilityInfo1.subType).assertEqual(0);
expect(abilityInfo1.readPermission).assertEqual("");
expect(abilityInfo1.writePermission).assertEqual("");
expect(abilityInfo1.targetAbility).assertEqual("");
expect(abilityInfo1.theme).assertEqual("");
expect(abilityInfo1.metaData.length).assertEqual(1);
expect(abilityInfo1.metaData[0].name).assertEqual("Data5A");
expect(abilityInfo1.metaData[0].value).assertEqual("float");
expect(abilityInfo1.metaData[0].extra).assertEqual("$string:mainability_description");
expect(abilityInfo2.metaData.length).assertEqual(1);
expect(abilityInfo2.metaData[0].name).assertEqual("Data5B");
expect(abilityInfo2.metaData[0].value).assertEqual("float");
expect(abilityInfo2.metaData[0].extra).assertEqual("$string:mainability_description");
expect(abilityInfo1.enabled).assertEqual(true);
} }
installer.uninstall(BUNDLE_NAME3, installParam, (err, data) => { installer.uninstall(BUNDLE_NAME3, installParam, (err, data) => {
checkInstallOrUninstall(err, data); checkInstallOrUninstall(err, data);
...@@ -396,6 +365,41 @@ describe('ActsBmsJsTest', function () { ...@@ -396,6 +365,41 @@ describe('ActsBmsJsTest', function () {
done(); done();
}); });
function checkAbilityInfos(info) {
expect(info.name).assertEqual(ABILITIY_NAME2);
expect(info.srcLanguage).assertEqual('js');
expect(info.srcPath).assertEqual('');
expect(info.label).assertEqual("$string:app_name");
expect(info.description).assertEqual("$string:mainability_description");
expect(info.icon).assertEqual("$media:icon");
expect(info.isVisible).assertEqual(true);
expect(info.permissions.length).assertEqual(0);
expect(info.deviceTypes[0]).assertEqual('phone');
expect(info.process).assertEqual("");
expect(info.uri).assertEqual("");
expect(info.bundleName).assertEqual(BUNDLE_NAME3);
expect(info.moduleName).assertEqual("entry");
expect(Object.keys(info.applicationInfo).length).assertLarger(0);
expect(info.type).assertEqual(1);
expect(info.orientation).assertEqual(0);
expect(info.launchMode).assertEqual(1);
expect(info.backgroundModes).assertEqual(0);
expect(info.descriptionId).assertLarger(0);
expect(info.formEnabled).assertEqual(false);
expect(info.iconId).assertLarger(0);
expect(info.labelId).assertLarger(0);
expect(info.subType).assertEqual(0);
expect(info.readPermission).assertEqual("");
expect(info.writePermission).assertEqual("");
expect(info.targetAbility).assertEqual("");
expect(info.theme).assertEqual("");
expect(info.metaData.length).assertEqual(1);
expect(info.metaData[0].name).assertEqual("Data5A");
expect(info.metaData[0].value).assertEqual("float");
expect(info.metaData[0].extra).assertEqual("$string:mainability_description");
expect(info.enabled).assertEqual(true);
}
function checkInstallOrUninstall(err, data) { function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册