提交 2b750444 编写于 作者: W wangtiantian

IssueNo:#I7LFTB

Description:add xts testcase
Sig:SIG_ApplicaitonFramework
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: Nwangtiantian <wangtiantian19@huawei.com>
上级 e948daa8
......@@ -56,6 +56,36 @@ export default function getBundleInfoForSelf() {
})
})
/*
* @tc.number: SUB_BMS_SERVICE_SPLIT_0032
* @tc.name: getBundleInfoForSelfSyncAtomicService
* @tc.desc: Test getBundleInfoForSelfSync with AtomicService
*/
it('getBundleInfoForSelfSyncAtomicService', 0, async function (done) {
let data = bundle.getBundleInfoForSelfSync(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE);
let preloadItemTest: bundle.PreloadItem = data.hapModulesInfo[2].preloads[0];
expect(typeof (preloadItemTest.moduleName)).assertEqual('string');
let dependencyTest: bundle.Dependency = data.hapModulesInfo[2].dependencies[0];
expect(typeof (dependencyTest.moduleName)).assertEqual('string');
console.info("getBundleInfoForSelfApplicationPro" + JSON.stringify(data.appInfo));
for (let i = 0; i < data.hapModulesInfo.length; i++) {
console.info("getBundleInfoForSelfApplicationPro : " + i + " ==" + JSON.stringify(data.hapModulesInfo[i]));
}
expect(data.appInfo.bundleType).assertEqual(bundle.BundleType.ATOMIC_SERVICE);
expect(data.hapModulesInfo[0].type).assertEqual(bundle.ModuleType.FEATURE);
expect(data.hapModulesInfo[0].preloads.length).assertEqual(0);
expect(data.hapModulesInfo[0].dependencies.length).assertEqual(0);
expect(data.hapModulesInfo[1].type).assertEqual(bundle.ModuleType.SHARED);
expect(data.hapModulesInfo[1].preloads.length).assertEqual(0);
expect(data.hapModulesInfo[1].dependencies.length).assertEqual(0);
expect(data.hapModulesInfo[2].type).assertEqual(bundle.ModuleType.ENTRY);
expect(data.hapModulesInfo[2].preloads.length).assertEqual(2);
expect(data.hapModulesInfo[2].preloads[0].moduleName).assertEqual("feature");
expect(data.hapModulesInfo[2].preloads[1].moduleName).assertEqual("shared");
expect(data.hapModulesInfo[2].dependencies.length).assertEqual(1);
expect(data.hapModulesInfo[2].dependencies[0].moduleName).assertEqual("feature");
done();
})
})
}
\ No newline at end of file
......@@ -1023,6 +1023,121 @@ export default function getBundleInfoForSelf() {
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0138
* @tc.name: getBundleInfoForSelfSyncParamErrCal
* @tc.desc: Test getBundleInfoForSelfSync with error param.
*/
it('getBundleInfoForSelfSyncParamErrCal', 0, async function (done) {
try {
let bundleInfo = bundle.getBundleInfoForSelfSync(null);
expect(bundleInfo).assertFail();
} catch (err) {
console.info("ParamErrCal null fail2 " + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
}
try {
let bundleInfo = bundle.getBundleInfoForSelfSync(undefined);
expect(bundleInfo).assertFail();
} catch (err) {
console.info("ParamErrCal undefined fail2 " + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0139
* @tc.name: getBundleInfoForSelfSyncDisCal
* @tc.desc: Test getBundleInfoForSelfSync with disable flag.
*/
it('getBundleInfoForSelfSyncDisCal', 0, async function (done) {
let data = bundle.getBundleInfoForSelfSync(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_DISABLE);
console.info("DisCal" + JSON.stringify(data));
checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0);
expect(data.permissionGrantStates.length).assertEqual(0);
expect(data.signatureInfo).assertEqual(null);
done();
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0140
* @tc.name: getBundleInfoForSelfSyncSigCal
* @tc.desc: Test getBundleInfoForSelfSync with signatureInfo flag.
*/
it('getBundleInfoForSelfSyncSigCal', 0, async function (done) {
let data = bundle.getBundleInfoForSelfSync(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO);
console.info("SigCal" + JSON.stringify(data.signatureInfo));
checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0);
expect(data.permissionGrantStates.length).assertEqual(0);
expect(data.signatureInfo.appId).assertEqual(APPID);
expect(data.signatureInfo.fingerprint).assertEqual(FINGERPRINT);
done();
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0141
* @tc.name: getBundleInfoForSelfSyncModuleCal
* @tc.desc: Test getBundleInfoForSelfSync with hapModuleInfo flag.
*/
it('getBundleInfoForSelfSyncModuleCal', 0, async function (done) {
let data = bundle.getBundleInfoForSelfSync(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE);
console.info("getBundleInfoForSelfSyncPro" + JSON.stringify(data.hapModulesInfo));
checkCommonBundleInfo(data);
expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(1);
expect(data.hapModulesInfo[0].name).assertEqual("testModule");
expect(data.hapModulesInfo[0].icon).assertEqual("$media:icon");
expect(data.hapModulesInfo[0].iconId).assertLarger(0);
expect(data.hapModulesInfo[0].label).assertEqual("$string:entry_label");
expect(data.hapModulesInfo[0].labelId).assertLarger(0);
expect(data.hapModulesInfo[0].description).assertEqual("$string:testModule_entry_dsc");
expect(data.hapModulesInfo[0].descriptionId).assertLarger(0);
expect(data.hapModulesInfo[0].mainElementName).assertEqual(ABILITY_NAME);
expect(data.hapModulesInfo[0].abilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].extensionAbilitiesInfo.length).assertEqual(0);
expect(data.hapModulesInfo[0].metadata.length).assertEqual(0);
expect(data.hapModulesInfo[0].deviceTypes.length).assertEqual(2);
expect(data.hapModulesInfo[0].deviceTypes[0]).assertEqual("default");
expect(data.hapModulesInfo[0].deviceTypes[1]).assertEqual("tablet");
expect(data.hapModulesInfo[0].installationFree).assertFalse();
expect(data.hapModulesInfo[0].hashValue).assertEqual("");
expect(data.reqPermissionDetails.length).assertEqual(0);
expect(data.permissionGrantStates.length).assertEqual(0);
expect(data.signatureInfo).assertEqual(null);
done();
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERY_0142
* @tc.name: getBundleInfoForSelfSyncCal
* @tc.desc: Test getBundleInfoForSelfSync with default flag
*/
it('getBundleInfoForSelfSyncCal', 0, async function (done) {
let data = bundle.getBundleInfoForSelfSync(bundle.BundleFlag.GET_BUNDLE_INFO_DEFAULT);
console.info("getBundleInfoForSelfSyncCal" + JSON.stringify(data));
expect(data.name).assertEqual(BUNDLE_NAME);
expect(data.vendor).assertEqual(VENDOR);
expect(data.versionCode).assertEqual(1000000);
expect(data.versionName).assertEqual("1.0.0");
expect(data.minCompatibleVersionCode).assertEqual(1000000);
expect(data.targetVersion).assertEqual(9);
expect(data.installTime).assertLarger(0);
expect(data.updateTime).assertLarger(0);
expect(data.appInfo).assertEqual(null);
expect(data.hapModulesInfo.length).assertEqual(0);
expect(data.reqPermissionDetails.length).assertEqual(0);
expect(data.permissionGrantStates.length).assertEqual(0);
expect(data.signatureInfo).assertEqual(null);
done();
})
function checkCommonBundleInfo(data) {
expect(data.name).assertEqual(BUNDLE_NAME);
expect(data.vendor).assertEqual(VENDOR);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册