未验证 提交 35723527 编写于 作者: O openharmony_ci 提交者: Gitee

!3297 SetAbilityEnabled和IsAbilityEnabled中传入的moduleName与bundleName行为一致

Merge pull request !3297 from wangtiantian/moduleName
......@@ -22,6 +22,7 @@ const BUNDLE_NAME = 'com.example.bmsmodulename';
const MODULE_NAME1 = '';
const MODULE_NAME2 = 'noModule';
const MODULE_NAME3 = 'entry';
const MODULE_NAME4 = undefined;
const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT;
const DEFAULT_USER_ID = 100;
const SUCCESS_CODE = 0;
......@@ -42,6 +43,11 @@ const ABILITY_INFO_THREE = {
moduleName: MODULE_NAME3,
name: ABILITY_NAME
};
const ABILITY_INFO_FOUR = {
bundleName: BUNDLE_NAME,
moduleName: MODULE_NAME4,
name: ABILITY_NAME
};
export default function actsBmsJsModuleNameTest() {
describe('actsBmsJsModuleNameTest', function () {
......@@ -268,17 +274,18 @@ export default function actsBmsJsModuleNameTest() {
it('IsAbilityEnabled_0100', 0, async function (done) {
await bundle.isAbilityEnabled(ABILITY_INFO_ONE)
.then(data => {
expect(data).assertFail();
console.info('[IsAbilityEnabled_0100]Return data successful: ' + JSON.stringify(data));
expect(data).assertTrue();
}).catch((err) => {
console.error('[IsAbilityEnabled_0100]Operation failed. Err: ' + JSON.stringify(err));
expect(err).assertEqual(INVALID_PARAM);
expect(err).assertFail();
});
bundle.isAbilityEnabled(ABILITY_INFO_ONE, (err, data) => {
expect(data).assertEqual(undefined);
expect(err).assertEqual(SUCCESS_CODE);
if (err) {
console.error('[IsAbilityEnabled_0100]Operation failed. Err: ' + JSON.stringify(err));
}
expect(err).assertEqual(INVALID_PARAM);
expect(data).assertTrue();
console.info("'[IsAbilityEnabled_0100]Return data: " + JSON.stringify(data));
done();
});
......@@ -320,7 +327,7 @@ export default function actsBmsJsModuleNameTest() {
expect(data).assertTrue();
}).catch((err) => {
console.error('[IsAbilityEnabled_0300]Operation failed. Err: ' + JSON.stringify(err));
expect(err).assertEqual(SUCCESS_CODE);
expect(err).assertFail();
});
bundle.isAbilityEnabled(ABILITY_INFO_THREE, (err, data) => {
expect(err).assertEqual(SUCCESS_CODE);
......@@ -333,6 +340,30 @@ export default function actsBmsJsModuleNameTest() {
});
});
/*
* @tc.number: IsAbilityEnabled_0400
* @tc.name: test isAbilityEnabled
* @tc.desc: test empty moduleName
*/
it('IsAbilityEnabled_0400', 0, async function (done) {
await bundle.isAbilityEnabled(ABILITY_INFO_FOUR)
.then(data => {
expect(data).assertFail();
}).catch((err) => {
console.error('[IsAbilityEnabled_0400]Operation failed. Err: ' + JSON.stringify(err));
expect(err).assertEqual(INVALID_PARAM);
});
bundle.isAbilityEnabled(ABILITY_INFO_FOUR, (err, data) => {
expect(data).assertEqual(undefined);
if (err) {
console.error('[IsAbilityEnabled_0400]Operation failed. Err: ' + JSON.stringify(err));
}
expect(err).assertEqual(INVALID_PARAM);
console.info("'[IsAbilityEnabled_0400]Return data: " + JSON.stringify(data));
done();
});
});
/*
* @tc.number: QueryAbilityByWant_0100
* @tc.name: test queryAbilityByWant
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册