From e334134546a7ed2c534bcab020c20165cd8e80e6 Mon Sep 17 00:00:00 2001 From: dy Date: Wed, 9 Mar 2022 14:48:41 +0800 Subject: [PATCH] fix assert Signed-off-by: dy --- .../test/getAbilityInfoJsunit.test.ets | 36 ++++++++++++++++--- .../test/getHapModuleInfoJsunit.test.ets | 10 +++--- .../test/getAbilityInfoJsunit2.test.ets | 36 ++++++++++++++++--- .../test/getHapModuleInfoJsunit_app1.test.ets | 10 +++--- 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets index e972942f2..447fc3ba9 100644 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets +++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets @@ -291,13 +291,39 @@ export default function getHapModuleInfoJsunit() { expect(info.icon).assertEqual("$media:icon"); expect(info.process).assertEqual(""); expect(info.supportedModes).assertEqual(0); - expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - expect(info.moduleInfos[0].moduleName).assertEqual("entry"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + if (info.moduleSourceDirs.length == 1){ + expect(info.moduleInfos[0].moduleName).assertEqual("entry"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + }else if(info.moduleSourceDirs.length == 2) { + if (info.moduleInfos[0].moduleName == "myapplication1") { + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication1"); + expect(info.moduleInfos[1].moduleName).assertEqual("entry"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + }else{ + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication2"); + expect(info.moduleInfos[1].moduleName).assertEqual("entry"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + } + }else { + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication1"); + expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication2"); + expect(info.moduleInfos[2].moduleName).assertEqual("entry"); + expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + } console.log(msg + "---checkApplicationInfo End--- "); diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets index 70ad8f51d..7d99f6be3 100644 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets +++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets @@ -233,8 +233,8 @@ export default function getHapModuleInfoJsunit() { expect(data.label).assertEqual("$string:entry_MainAbility"); expect(data.description).assertEqual("$string:mainability_description"); expect(data.icon).assertEqual("$media:icon"); - expect(data.descriptionId).assertEqual(16777220); - expect(data.iconId).assertEqual(16777221); + expect(data.descriptionId > 0).assertTrue(); + expect(data.iconId > 0).assertTrue(); expect(data.moduleName).assertEqual("entry"); expect(data.process).assertEqual(""); expect(data.targetAbility).assertEqual(""); @@ -254,7 +254,7 @@ export default function getHapModuleInfoJsunit() { expect(data.minFormWidth).assertEqual(0); expect(data.defaultFormWidth).assertEqual(0); expect(data.uri).assertEqual(""); - expect(data.labelId).assertEqual(16777218); + expect(data.labelId > 0).assertTrue(); expect(data.subType).assertEqual(0); console.log(msg+ "---checkAbilityInfo End--- "); } @@ -337,13 +337,11 @@ export default function getHapModuleInfoJsunit() { } expect(info.name).assertEqual("com.ohos.acecollaboration"); expect(info.description).assertEqual("$string:mainability_description"); - expect(info.descriptionId).assertEqual(16777220); + expect(info.descriptionId > 0).assertTrue(); expect(info.systemApp).assertEqual(true); expect(info.enabled).assertEqual(true); expect(info.label).assertEqual("$string:entry_MainAbility"); - expect(info.labelId).assertEqual("16777218"); expect(info.icon).assertEqual("$media:icon"); - expect(info.iconId).assertEqual("16777221"); expect(info.process).assertEqual(""); expect(info.supportedModes).assertEqual(0); expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets index 96062c51c..827da661a 100644 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets +++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets @@ -206,13 +206,39 @@ export default function getAbilityInfoJsunit() { expect(info.icon).assertEqual("$media:icon"); expect(info.process).assertEqual(""); expect(info.supportedModes).assertEqual(0); - expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); - expect(info.moduleInfos[0].moduleName).assertEqual("entry"); - expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + - "com.ohos.acecollaboration/com.ohos.acecollaboration"); expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + if (info.moduleSourceDirs.length == 1){ + expect(info.moduleInfos[0].moduleName).assertEqual("entry"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + }else if(info.moduleSourceDirs.length == 2) { + if (info.moduleInfos[0].moduleName == "myapplication1") { + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication1"); + expect(info.moduleInfos[1].moduleName).assertEqual("entry"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + }else{ + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication2"); + expect(info.moduleInfos[1].moduleName).assertEqual("entry"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + } + }else { + expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication1"); + expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2"); + expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.example.myapplication2"); + expect(info.moduleInfos[2].moduleName).assertEqual("entry"); + expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" + + "com.ohos.acecollaboration/com.ohos.acecollaboration"); + } console.log(msg+ "---checkApplicationInfo End--- "); } }) diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets index 801d2d6b2..685a71d10 100644 --- a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets +++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets @@ -183,8 +183,8 @@ export default function getHapModuleInfoJsunit() { expect(data.label).assertEqual("$string:myapplication1_MainAbility"); expect(data.description).assertEqual("$string:description_mainability"); expect(data.icon).assertEqual("$media:icon"); - expect(data.descriptionId).assertEqual(16777220); - expect(data.iconId).assertEqual(16777221); + expect(data.descriptionId > 0).assertTrue(); + expect(data.iconId > 0).assertTrue(); expect(data.moduleName).assertEqual("myapplication1"); expect(data.process).assertEqual(""); expect(data.targetAbility).assertEqual(""); @@ -204,7 +204,7 @@ export default function getHapModuleInfoJsunit() { expect(data.minFormWidth).assertEqual(0); expect(data.defaultFormWidth).assertEqual(0); expect(data.uri).assertEqual(""); - expect(data.labelId).assertEqual(16777218); + expect(data.labelId > 0).assertTrue(); expect(data.subType).assertEqual(0); console.log(msg+ "---checkAbilityInfo End--- "); } @@ -254,13 +254,11 @@ export default function getHapModuleInfoJsunit() { expect(typeof (info.entryDir)).assertEqual("string"); expect(info.name).assertEqual("com.ohos.acecollaboration"); expect(info.description).assertEqual("$string:mainability_description"); - expect(info.descriptionId).assertEqual(16777220); + expect(info.descriptionId > 0).assertTrue(); expect(info.systemApp).assertEqual(true); expect(info.enabled).assertEqual(true); expect(info.label).assertEqual("$string:entry_MainAbility"); - expect(info.labelId).assertEqual("16777218"); expect(info.icon).assertEqual("$media:icon"); - expect(info.iconId).assertEqual("16777221"); expect(info.process).assertEqual(""); expect(info.supportedModes).assertEqual(0); if (info.moduleSourceDirs.length == 1){ -- GitLab