diff --git a/test/unittest/js_test/requestAgentTaskTest/.gitignore b/test/unittest/js_test/requestAgentTaskTest/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/AppScope/app.json5 b/test/unittest/js_test/requestAgentTaskTest/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a8ee954ebc141b02bff612d829c9c01a88cf8161 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} diff --git a/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/element/string.json b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/element/string.json index ee69f9a861d9dc269ed6638735d52674583498e1..1080233f01384411ec684b58955cb8808746fdd3 100644 --- a/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/element/string.json +++ b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/element/string.json @@ -1,8 +1,8 @@ { - "string":[ + "string": [ { - "name":"app_name", - "value":"ohosProject" + "name": "app_name", + "value": "MyApplication" } ] -} \ No newline at end of file +} diff --git a/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/background.png b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/background.png differ diff --git a/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/foreground.png b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb Binary files /dev/null and b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/foreground.png differ diff --git a/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/layered_image.json b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/AppScope/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/BUILD.gn b/test/unittest/js_test/requestAgentTaskTest/BUILD.gn index abb3221242e64573d6b6640b2f70474913dee46f..b184abca8811b4558914d17c3bc6394019769e77 100644 --- a/test/unittest/js_test/requestAgentTaskTest/BUILD.gn +++ b/test/unittest/js_test/requestAgentTaskTest/BUILD.gn @@ -13,19 +13,19 @@ import("//build/test.gni") -ohos_js_stage_unittest("RequestAgentTaskTest") { - module_out_path = "request/request/requestAgentTaskTest" +ohos_app("RequestAgentTaskTest") { + hap_name = "RequestAgentTaskTest" + subsystem_name = "request" + part_name = "request" + hap_out_dir = "${root_build_dir}/tests/unittest/request/request/requestAgentTaskTest" + certificate_profile = "signature/openharmony_sx.p7b" + sdk_home = "//prebuilts/ohos-sdk/linux" + sdk_type_name = ["sdk.dir"] - hap_profile = "entry/src/main/module.json" deps = [ ":actbmsstageetstest_js_assets", ":actbmsstageetstest_resources", ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "RequestAgentTaskTest" - subsystem_name = "request" - part_name = "request" } ohos_app_scope("actbmsstageetstest_app_profile") { app_profile = "AppScope/app.json" diff --git a/test/unittest/js_test/requestAgentTaskTest/build-profile.json5 b/test/unittest/js_test/requestAgentTaskTest/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..79d4fba2f14da4b55e13e4e9f11e4812d5b0983d --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/build-profile.json5 @@ -0,0 +1,36 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compileSdkVersion": 20, + "compatibleSdkVersion": 20, + "runtimeOS": "OpenHarmony" + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/code-linter.json5 b/test/unittest/js_test/requestAgentTaskTest/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..073990fa45394e1f8e85d85418ee60a8953f9b99 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/code-linter.json5 @@ -0,0 +1,32 @@ +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@security/no-unsafe-aes": "error", + "@security/no-unsafe-hash": "error", + "@security/no-unsafe-mac": "warn", + "@security/no-unsafe-dh": "error", + "@security/no-unsafe-dsa": "error", + "@security/no-unsafe-ecdsa": "error", + "@security/no-unsafe-rsa-encrypt": "error", + "@security/no-unsafe-rsa-sign": "error", + "@security/no-unsafe-rsa-key": "error", + "@security/no-unsafe-dsa-key": "error", + "@security/no-unsafe-dh-key": "error", + "@security/no-unsafe-3des": "error" + } +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/.gitignore b/test/unittest/js_test/requestAgentTaskTest/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/build-profile.json5 b/test/unittest/js_test/requestAgentTaskTest/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4d611879c7913fb0610c686e2399258ab3a6dad1 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/hvigorfile.ts b/test/unittest/js_test/requestAgentTaskTest/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0e3a1ab98a91bc918d6404b2413111a5011f14a --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins: [] /* Custom plugin to extend the functionality of Hvigor. */ +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/obfuscation-rules.txt b/test/unittest/js_test/requestAgentTaskTest/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/oh-package.json5 b/test/unittest/js_test/requestAgentTaskTest/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/ets/test/CacheDownloadInfo.test.ets b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/ets/test/CacheDownloadInfo.test.ets index 9537fd7641d9bd9db0495ae69ed0dad00afdf73f..baed04676ba512f3cb68b2860ac33d50b6037a13 100644 --- a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/ets/test/CacheDownloadInfo.test.ets +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/ets/test/CacheDownloadInfo.test.ets @@ -98,7 +98,7 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt", options); await sleep(5000); - let downloadInfo = + let downloadInfo: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); let total_time = 0; if (downloadInfo == undefined) { @@ -111,7 +111,7 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt", options); await sleep(5000); - let downloadInfo2 = + let downloadInfo2: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo2 == undefined) { console.error('testGetDownloadInfo001 downloadInfo2 undefined.'); @@ -140,7 +140,7 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt", options); await sleep(5000); - let downloadInfo = + let downloadInfo: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo == undefined) { console.error('testGetDownloadInfo002 downloadInfo undefined.'); @@ -150,14 +150,14 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg", options); await sleep(5000); - let downloadInfo2 = + let downloadInfo2: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg"); if (downloadInfo2 == undefined) { console.error('testGetDownloadInfo002 downloadInfo2 undefined.'); expect(false).assertTrue(); done(); } - let downloadInfo_1 = + let downloadInfo_1: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo_1 == undefined) { done(); @@ -185,7 +185,7 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt", options); await sleep(5000); - let downloadInfo = + let downloadInfo: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo == undefined) { console.error('testGetDownloadInfo003 downloadInfo undefined.'); @@ -195,7 +195,7 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg", options); await sleep(5000); - let downloadInfo2 = + let downloadInfo2: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg"); if (downloadInfo2 == undefined) { console.error('testGetDownloadInfo003 downloadInfo2 undefined.'); @@ -205,14 +205,14 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/audio_test.mp3", options); await sleep(5000); - let downloadInfo3 = + let downloadInfo3: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/audio_test.mp3"); if (downloadInfo3 == undefined) { console.error('testGetDownloadInfo003 downloadInfo3 undefined.'); expect(false).assertTrue(); done(); } - let downloadInfo_1 = + let downloadInfo_1: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo_1 == undefined) { done(); @@ -240,7 +240,7 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt", options); await sleep(5000); - let downloadInfo = + let downloadInfo: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo == undefined) { console.error('testGetDownloadInfo004 downloadInfo undefined.'); @@ -250,14 +250,14 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg", options); await sleep(5000); - let downloadInfo2 = + let downloadInfo2: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg"); if (downloadInfo2 == undefined) { console.error('testGetDownloadInfo004 downloadInfo2 undefined.'); expect(false).assertTrue(); done(); } - let downloadInfo_1 = + let downloadInfo_1: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/test400K.txt"); if (downloadInfo_1 == undefined) { console.error('testGetDownloadInfo004 downloadInfo2 undefined.'); @@ -267,14 +267,14 @@ export default function cacheDownloadInfo() { cacheDownload.download("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/audio_test.mp3", options); await sleep(5000); - let downloadInfo3 = + let downloadInfo3: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/audio_test.mp3"); if (downloadInfo3 == undefined) { console.error('testGetDownloadInfo004 downloadInfo3 undefined.'); expect(false).assertTrue(); done(); } - let downloadInfo_2 = + let downloadInfo_2: cacheDownload.DownloadInfo | undefined = cacheDownload.getDownloadInfo("https://gitee.com/tiga-ultraman/downloadTests/releases/download/v1.01/edge_picture.jpg"); if (downloadInfo_2 == undefined) { done(); diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/module.json5 b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/module.json5 index 8a95a8419351bc0b08a9e448778aad3ab9ff722a..663b15b842bd534637173b2d734f500561e2ea0c 100644 --- a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/module.json5 +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/module.json5 @@ -2,7 +2,7 @@ "module": { "name": "entry", "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", + "srcEntry": "./ets/Application/AbilityStage.ts", "description": "$string:testModule_entry_dsc", "mainElement": "com.acts.request.MainAbility", "deviceTypes": [ @@ -12,7 +12,6 @@ ], "deliveryWithInstall": true, "installationFree": false, - "uiSyntax": "ets", "pages": "$profile:main_pages", "metadata": [ { diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/color.json b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..812ea7cc930d80f50a9a5545da8124fb0cf40715 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/color.json @@ -0,0 +1,160 @@ +{ + "color": [ + { + "name": "ohos_id_menu_outer_border_color", + "value": "#66000000" + }, + { + "name": "dialog_outer_border_color", + "value": "#66000000" + }, + { + "name": "ohos_id_popup_outer_border_color", + "value": "#66000000" + }, + { + "name": "toast_outer_border_color", + "value": "#66000000" + }, + { + "name": "comp_outline_color", + "value": "#66000000" + }, + { + "name": "comp_border_color", + "value": "#33FFFFFF" + }, + { + "name": "ohos_id_color_component_normal", + "value": "#33ffffff" + }, + { + "name": "ohos_id_color_list_separator", + "value": "#4Dffffff" + }, + { + "name": "comp_divider", + "value": "#4Dffffff" + }, + { + "name": "ohos_id_color_subheading_separator", + "value": "#33ffffff" + }, + { + "name": "ohos_id_color_fourth", + "value": "#4Dffffff" + }, + { + "name": "ohos_id_color_bottom_tab_icon_off", + "value": "#4Dffffff" + }, + { + "name": "ohos_fa_list_separator", + "value": "#4Dffffff" + }, + { + "name": "ohos_fa_icon_fourth", + "value": "#4Dffffff" + }, + { + "name": "ohos_id_color_click_effect", + "value": "#3Fffffff" + }, + { + "name": "ohos_id_color_hover", + "value": "#33ffffff" + }, + { + "name": "ohos_id_color_text_field_bg", + "value": "#33ffffff" + }, + { + "name": "ohos_id_color_text_field_sub_bg", + "value": "#33ffffff" + }, + { + "name": "ohos_id_color_button_normal", + "value": "#33ffffff" + }, + { + "name": "ohos_toggle_bg", + "value": "#33ffffff" + }, + { + "name": "ohos_fa_component_normal", + "value": "#33ffffff" + }, + { + "name": "ohos_fa_click_effect", + "value": "#33ffffff" + }, + { + "name": "ohos_fa_list_card_bg_blur", + "value": "#33ffffff" + }, + { + "name": "ohos_fa_list_card_bg", + "value": "#33ffffff" + }, + { + "name": "gray_02", + "value": "#303336" + }, + { + "name": "gray_03", + "value": "#3F4246" + }, + { + "name": "gray_04", + "value": "#575A60" + }, + { + "name": "comp_background_list_card", + "value": "#33FFFFFF" + }, + { + "name": "ohos_id_color_dialog_bg", + "value": "#ff303336" + }, + { + "name": "comp_background_primary", + "value": "#ff303336" + }, + { + "name": "ohos_id_color_panel_bg", + "value": "#ff303336" + }, + { + "name": "ohos_id_color_list_card_bg", + "value": "#ff303336" + }, + { + "name": "ohos_id_color_card_bg", + "value": "#ff3F4246" + }, + { + "name": "ohos_fa_background_blur", + "value": "#cc303336" + }, + { + "name": "ohos_fa_sub_background", + "value": "#ff3F4246" + }, + { + "name": "container_modal_background", + "value": "#ff333333" + }, + { + "name": "container_modal_unfocus_background", + "value": "#ff404040" + }, + { + "name": "tips_outer_border_color_dark", + "value": "#66000000" + }, + { + "name": "default_background_color", + "value": "#D9FFFFFF" + } + ] +} diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/string.json b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/string.json index a4e9ba5b8d282aa4e86eb9389bf7c535226fd1c4..0ed68bbcbe96dd8272536700a47b5863f957fbde 100644 --- a/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/string.json +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/main/resources/base/element/string.json @@ -39,6 +39,22 @@ { "name": "permission_reason", "value": "Need permission" + }, + { + "name": "INTERNET_permission_reason", + "value": "need use ohos.permission.INTERNET." + }, + { + "name": "WRITE_MEDIA_permission_reason", + "value": "need use ohos.permission.WRITE_MEDIA" + }, + { + "name": "READ_MEDIA_permission_reason", + "value": "need use ohos.permission.WRITE_MEDIA" + }, + { + "name": "GET_NETWORK_INFO_permission_reason", + "value": "need ohos.permission.GET_NETWORK_INFO." } ] } diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/mock/mock-config.json5 b/test/unittest/js_test/requestAgentTaskTest/entry/src/mock/mock-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7a73a41bfdf76d6f793007240d80983a52f15f97 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/mock/mock-config.json5 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/ets/test/Ability.test.ets b/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,35 @@ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/ets/test/List.test.ets b/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,5 @@ +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/module.json5 b/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..509a3a28a3e6be8d7f98cc563fa8195657d77d1d --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/ohosTest/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/test/List.test.ets b/test/unittest/js_test/requestAgentTaskTest/entry/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/test/List.test.ets @@ -0,0 +1,5 @@ +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/entry/src/test/LocalUnit.test.ets b/test/unittest/js_test/requestAgentTaskTest/entry/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/entry/src/test/LocalUnit.test.ets @@ -0,0 +1,33 @@ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/hvigor/hvigor-config.json5 b/test/unittest/js_test/requestAgentTaskTest/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..941ccf5d6617fcf0eee14913e230f293eb86ca18 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/hvigor/hvigor-config.json5 @@ -0,0 +1,5 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} diff --git a/test/unittest/js_test/requestAgentTaskTest/hvigorfile.ts b/test/unittest/js_test/requestAgentTaskTest/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..47113e2e36ecefde41c136272a0bd6ff745cffe4 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins: [] /* Custom plugin to extend the functionality of Hvigor. */ +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/oh-package-lock.json5 b/test/unittest/js_test/requestAgentTaskTest/oh-package-lock.json5 new file mode 100644 index 0000000000000000000000000000000000000000..01a548f61ab39a5d498f12641c414d518f5dfab5 --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/oh-package-lock.json5 @@ -0,0 +1,19 @@ +{ + "meta": { + "stableOrder": true + }, + "lockfileVersion": 3, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "@ohos/hypium@1.0.21": "@ohos/hypium@1.0.21" + }, + "packages": { + "@ohos/hypium@1.0.21": { + "name": "@ohos/hypium", + "version": "1.0.21", + "integrity": "sha512-iyKGMXxE+9PpCkqEwu0VykN/7hNpb+QOeIuHwkmZnxOpI+dFZt6yhPB7k89EgV1MiSK/ieV/hMjr5Z2mWwRfMQ==", + "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.21.har", + "registryType": "ohpm" + } + } +} \ No newline at end of file diff --git a/test/unittest/js_test/requestAgentTaskTest/oh-package.json5 b/test/unittest/js_test/requestAgentTaskTest/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1c203b2f65c272d9590e1ee4a9cf50c5f76c345d --- /dev/null +++ b/test/unittest/js_test/requestAgentTaskTest/oh-package.json5 @@ -0,0 +1,6 @@ +{ + "modelVersion": "5.0.0", + "devDependencies": { + "@ohos/hypium": "1.0.21" + } +}