提交 cd6afaca 编写于 作者: I inter515

代码规范修改-移除getBundleArchiveInfo接口

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 4bbc855c
......@@ -38,17 +38,25 @@ describe('ActsBmsQueryAbilityByWant', function () {
it('bms_queryAbilityByWant_0100', 0, async function (done) {
await bundle.getBundleInstaller().then(installer => {
installer.install(BUNDLE_PATH1, installParam, onReceiveinstallEvent);
function onReceiveinstallEvent(err, data) {
async function onReceiveinstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID).then(data => {
expect(data).assertEqual("QueryAbilityInfos failed");
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID, (err, data) => {
if (err) {
expect(err).assertEqual(1);
}
expect(err).assertEqual(1);
expect(data).assertEqual("QueryAbilityInfos failed");
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
......@@ -72,13 +80,28 @@ describe('ActsBmsQueryAbilityByWant', function () {
},
bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID).then(data => {
expect(data.length).assertLarger(0);
for (let i = 0; i < data.length; ++i) {
expect(data[i].applicationInfo.systemApp).assertEqual(true);
}
done();
}
).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
action: ['action.system.home'],
entities: ['entity.system.home']
},
bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID, (err, data) => {
if (err) {
expect(err).assertFail();
}
expect(data.length).assertLarger(0);
for (let i = 0; i < data.length; ++i) {
expect(data[i].applicationInfo.systemApp).assertEqual(true);
}
done();
});
});
......@@ -109,45 +132,28 @@ describe('ActsBmsQueryAbilityByWant', function () {
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID);
for(let i = 0; i < dataInfos.length ; i ++){
console.info ('dataInfos============='+ i);
for (const item in dataInfos[0]) {
const a = dataInfos[0][item];
console.info(item+":"+ JSON.stringify(a));
};
};
expect(dataInfos.length).assertEqual(1);
expect(dataInfos[0].name).assertEqual(ABILITIY_NAME8);
expect(dataInfos[0].label).assertEqual('$string:app_name');
expect(dataInfos[0].description).assertEqual('$string:mainability_description');
expect(dataInfos[0].icon).assertEqual("$media:icon");
expect(dataInfos[0].srcPath).assertEqual("");
expect(dataInfos[0].srcLanguage).assertEqual("js");
expect(dataInfos[0].isVisible).assertEqual(false);
expect(dataInfos[0].permissions.length).assertEqual(0);
expect(dataInfos[0].deviceCapabilities.length).assertEqual(0);
expect(dataInfos[0].deviceTypes[0]).assertEqual('phone');
expect(dataInfos[0].process).assertEqual('');
expect(dataInfos[0].uri).assertEqual('');
expect(dataInfos[0].bundleName).assertEqual(SYSTEM_NAME);
expect(dataInfos[0].moduleName).assertEqual("entry");
expect(Object.keys(dataInfos[0].applicationInfo).length).assertLarger(0);
expect(dataInfos[0].type).assertEqual(1);
expect(dataInfos[0].orientation).assertEqual(0);
expect(dataInfos[0].launchMode).assertEqual(1);
expect(dataInfos[0].backgroundModes).assertEqual(0);
expect(dataInfos[0].descriptionId).assertLarger(0);
expect(dataInfos[0].formEnabled).assertEqual(false);
expect(dataInfos[0].iconId).assertLarger(0);
expect(dataInfos[0].labelId).assertLarger(0);
expect(dataInfos[0].subType).assertEqual(0);
expect(dataInfos[0].readPermission).assertEqual("");
expect(dataInfos[0].writePermission).assertEqual("");
expect(dataInfos[0].targetAbility).assertEqual("");
expect(dataInfos[0].theme).assertEqual("");
expect(dataInfos[0].metaData.length).assertEqual(0);
expect(dataInfos[0].metadata.length).assertEqual(0);
expect(dataInfos[0].enabled).assertEqual(true);
cheackAbilityInfos(dataInfos[0]);
bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (err, data) => {
expect(data.length).assertEqual(1);
cheackAbilityInfos(data[0]);
});
installer.uninstall(SYSTEM_NAME, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
......@@ -155,6 +161,40 @@ describe('ActsBmsQueryAbilityByWant', function () {
});
});
async function cheackAbilityInfos(data) {
expect(data.name).assertEqual(ABILITIY_NAME8);
expect(data.label).assertEqual('$string:app_name');
expect(data.description).assertEqual('$string:mainability_description');
expect(data.icon).assertEqual("$media:icon");
expect(data.srcPath).assertEqual("");
expect(data.srcLanguage).assertEqual("js");
expect(data.isVisible).assertEqual(false);
expect(data.permissions.length).assertEqual(0);
expect(data.deviceCapabilities.length).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual('phone');
expect(data.process).assertEqual('');
expect(data.uri).assertEqual('');
expect(data.bundleName).assertEqual(SYSTEM_NAME);
expect(data.moduleName).assertEqual("entry");
expect(Object.keys(data.applicationInfo).length).assertLarger(0);
expect(data.type).assertEqual(1);
expect(data.orientation).assertEqual(0);
expect(data.launchMode).assertEqual(1);
expect(data.backgroundModes).assertEqual(0);
expect(data.descriptionId).assertLarger(0);
expect(data.formEnabled).assertEqual(false);
expect(data.iconId).assertLarger(0);
expect(data.labelId).assertLarger(0);
expect(data.subType).assertEqual(0);
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.theme).assertEqual("");
expect(data.metaData.length).assertEqual(0);
expect(data.metadata.length).assertEqual(0);
expect(data.enabled).assertEqual(true);
}
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......
......@@ -663,505 +663,6 @@ describe('ActsBundleManagerTest', function () {
}
})
/**
* @tc.number getBundleArchiveInfo_0100
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with one hap.
*/
it('getBundleArchiveInfo_0100', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], installParam, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
let datainfo = await demo.getBundleArchiveInfo(PATH + BMSJSTEST1, 1)
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual(".MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
installData.uninstall(NAME1, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
})
/**
* @tc.number getBundleArchiveInfo_0200
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with two haps.
*/
it('getBundleArchiveInfo_0200', 0, async function (done) {
let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST2, PATH + BMSJSTEST3], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
let datainfo = await demo.getBundleArchiveInfo(PATH + BMSJSTEST2, 1)
expect(datainfo.name).assertEqual(NAME2)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
installData.uninstall(NAME2, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
})
/**
* @tc.number getBundleArchiveInfo_0300
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with three haps.
*/
it('getBundleArchiveInfo_0300', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST4, PATH + BMSJSTEST5, PATH + BMSJSTEST6], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(-1);
expect(data.status).assertEqual(3);
expect(data.statusMessage).assertEqual('STATUS_INSTALL_FAILURE_INVALID');
getInfo();
});
async function getInfo() {
let datainfo = await demo.getBundleArchiveInfo(PATH + BMSJSTEST4, 1)
expect(datainfo.name).assertEqual(NAME3)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
installData.uninstall(NAME3, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
installData.uninstall(NAME4, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
installData.uninstall(NAME5, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
done();
});
});
});
}
})
/**
* @tc.number getBundleArchiveInfo_0400
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with error hap.
*/
it('getBundleArchiveInfo_0400', 0, async function (done) {
await demo.getBundleArchiveInfo(PATH + ERROR, 1).then(datainfo => {
console.info("getBundleArchiveInfo success" + JSON.stringify(datainfo))
expect(datainfo).assertFail()
done()
}).catch(err => {
console.info("getBundleArchiveInfo fail" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/**
* @tc.number getBundleArchiveInfo_0500
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_0500', 0, async function (done) {
let datainfo = await demo.getBundleArchiveInfo(' ', 1).then(datainfo => {
console.info("getBundleArchiveInfo success" + JSON.stringify(datainfo))
expect(datainfo).assertFail()
done()
}).catch(err => {
console.info("getBundleArchiveInfo fail" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/**
* @tc.number getBundleArchiveInfo_0600
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_0600', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
await demo.getBundleArchiveInfo(PATH + BMSJSTEST1, 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual(".MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
installData.uninstall(NAME1, {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
}
})
/**
* @tc.number getBundleArchiveInfo_0700
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with two hap.
*/
it('getBundleArchiveInfo_0700', 0, async function (done) {
let installData = await demo.getBundleInstaller();
installData.install([PATH + BMSJSTEST2, PATH + BMSJSTEST3], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
await demo.getBundleArchiveInfo(PATH + BMSJSTEST2, 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME2)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
installData.uninstall(NAME2, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
}
})
/**
* @tc.number getBundleArchiveInfo_0800
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with one hap.
*/
it('getBundleArchiveInfo_0800', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST4], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
await demo.getBundleArchiveInfo(PATH + BMSJSTEST4, 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME3)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
installData.uninstall(NAME3, {
userId: 100,
installFlag: 0,
isKeepData: false
}, (err, data) => {
done();
});
}
}
})
/**
* @tc.number getBundleArchiveInfo_0900
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with error hap.
*/
it('getBundleArchiveInfo_0900', 0, async function (done) {
await demo.getBundleArchiveInfo(PATH + ERROR, 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if (err) {
console.info("getBundleArchiveInfo error" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
return;
}
console.info("getBundleArchiveInfo sucess" + JSON.stringify(datainfo));
expect(datainfo).assertFail();
done();
}
})
/**
* @tc.number getBundleArchiveInfo_1000
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_1000', 0, async function (done) {
await demo.getBundleArchiveInfo(' ', 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if (err) {
console.info("getBundleArchiveInfo error" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
return;
}
console.info("getBundleArchiveInfo sucess" + JSON.stringify(datainfo));
expect(datainfo).assertFail();
done();
}
})
/**
* @tc.number getBundleArchiveInfo_1100
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_1100', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
await demo.getBundleArchiveInfo(PATH + BMSJSTEST1, 0, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual(".MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
installData.uninstall(NAME1, {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
}
})
/**
* @tc.number getBundleArchiveInfo_1200
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_1200', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
await demo.getBundleArchiveInfo(PATH + BMSJSTEST1, 0, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) {
expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual(".MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
installData.uninstall(NAME1, {
userId: 100,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
}
})
/**
* @tc.number getBundleInfo_0200
* @tc.name BUNDLE::getBundleInfo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册