diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets index 9610005e3ff39a6f74434f8c9a25da135ab6a0b1..0518e70eab75801ce4270dcd227fd501fbffcf8c 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets @@ -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