diff --git a/entry/src/main/ets/Utils/AssetUtils.ets b/entry/src/main/ets/Utils/AssetUtils.ets index 6ee6e0d4f44eb9d8bae1fec89da512a4d409695f..a2f61bd7ccc8e048fe3836a1fcd2898c7629f18a 100644 --- a/entry/src/main/ets/Utils/AssetUtils.ets +++ b/entry/src/main/ets/Utils/AssetUtils.ets @@ -10,7 +10,7 @@ class AssetUtils { return textEncoder.encodeInto(str); } - DeleteDataFromAssetStore(name: string) { + async DeleteDataFromAssetStore(name: string): Promise { let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, this.stringToArray(name)); try { @@ -47,7 +47,7 @@ class AssetUtils { } } - UpdateDataToAssetStore(newData: Uint8Array, name: string, label: string){ + async UpdateDataToAssetStore(newData: Uint8Array, name: string, label: string): Promise { let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, this.stringToArray(name)); let attrsToUpdate: asset.AssetMap = new Map(); @@ -65,23 +65,23 @@ class AssetUtils { } } - async QueryDataFromAssetStore(name: string):Promise{ + async QueryDataFromAssetStore(name: string){ let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, this.stringToArray(name)); query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ALL); let emptyArray = new Uint8Array(0); console.info('Asset query begin'); - try{ + try { console.info('Asset query begin in try'); let res: Array = await asset.query(query); - for(let i = 0; i < res.length; i++){ + for (let i = 0; i < res.length; i++) { console.info('Asset query begin in loop'); let secret: Uint8Array = res[i].get(asset.Tag.SECRET) as Uint8Array; console.info('secret output', secret); return secret; } console.info('Asset query begin again'); - }catch (error) { + } catch (error) { let err = error as BusinessError; console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); return emptyArray; diff --git a/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets index 8e4de99282050bad799ac892eb85ac5449364a51..54ae78a400756b59284e9717b81d98617d98ddd3 100644 --- a/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ b/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -4,12 +4,12 @@ import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; const DOMAIN = 0x0000; export default class EntryBackupAbility extends BackupExtensionAbility { - async onBackup() { + async onBackup(): Promise { hilog.info(DOMAIN, 'testTag', 'onBackup ok'); await Promise.resolve(); } - async onRestore(bundleVersion: BundleVersion) { + async onRestore(bundleVersion: BundleVersion): Promise { hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); await Promise.resolve(); } diff --git a/entry/src/main/ets/model/TrustedAuthentication.ets b/entry/src/main/ets/model/TrustedAuthentication.ets index 187295c0b2ae56fd161250b681dcf0fbf911cd2e..997299f1cb55972b36af7566bc57b6ed7213a948 100644 --- a/entry/src/main/ets/model/TrustedAuthentication.ets +++ b/entry/src/main/ets/model/TrustedAuthentication.ets @@ -25,7 +25,7 @@ class throwObject { isThrow: boolean = false } -function generateKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: throwObject) { +function generateKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: throwObject): Promise { return new Promise((resolve, reject) => { try { huks.generateKeyItem(keyAlias, huksOptions, (error, data) => { @@ -42,7 +42,7 @@ function generateKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwO }); }; -function GetEccVerifyProperties() { +function GetEccVerifyProperties(): Array { let properties: Array = [{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_ECC @@ -62,7 +62,7 @@ function GetEccVerifyProperties() { return properties; } -function GetEccSignProperties() { +function GetEccSignProperties(): Array { let properties: Array = [{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_ECC @@ -82,7 +82,7 @@ function GetEccSignProperties() { return properties; } -async function publicGenKeyFunc(keyAlias: string, huksOptions: huks.HuksOptions) { +async function publicGenKeyFunc(keyAlias: string, huksOptions: huks.HuksOptions): Promise { console.info(`enter promise generatekeyItem`); let throwObject: throwObject = { isThrow: false }; try { @@ -134,7 +134,7 @@ function stringToUint8Array(str: string): Uint8Array { return utf8Bytes; } -async function Verify(indata: string, signature: Uint8Array) { +async function Verify(indata: string, signature: Uint8Array): Promise { let indataArray = stringToUint8Array(indata) console.log('indata size = ' + indataArray.length + ' signature size = ' + signature.length); let appendInfo = signature.subarray(0, 41); @@ -464,7 +464,7 @@ class TrustedAuth { } } - async TestGenKeyForTuiPinSign() { + async TestGenKeyForTuiPinSign(): Promise { let properties: Array = [{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_ECC diff --git a/entry/src/mock/mock-config.json5 b/entry/src/mock/mock-config.json5 deleted file mode 100644 index 7a73a41bfdf76d6f793007240d80983a52f15f97..0000000000000000000000000000000000000000 --- a/entry/src/mock/mock-config.json5 +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets deleted file mode 100644 index 85c78f67579d6e31b5f5aeea463e216b9b141048..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ /dev/null @@ -1,35 +0,0 @@ -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/entry/src/ohosTest/ets/test/List.test.ets b/entry/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index 794c7dc4ed66bd98fa3865e07922906e2fcef545..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,5 +0,0 @@ -import abilityTest from './Ability.test'; - -export default function testsuite() { - abilityTest(); -} \ No newline at end of file diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 deleted file mode 100644 index 509a3a28a3e6be8d7f98cc563fa8195657d77d1d..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/module.json5 +++ /dev/null @@ -1,11 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false - } -} diff --git a/entry/src/test/List.test.ets b/entry/src/test/List.test.ets deleted file mode 100644 index bb5b5c3731e283dd507c847560ee59bde477bbc7..0000000000000000000000000000000000000000 --- a/entry/src/test/List.test.ets +++ /dev/null @@ -1,5 +0,0 @@ -import localUnitTest from './LocalUnit.test'; - -export default function testsuite() { - localUnitTest(); -} \ No newline at end of file diff --git a/entry/src/test/LocalUnit.test.ets b/entry/src/test/LocalUnit.test.ets deleted file mode 100644 index 165fc1615ee8618b4cb6a622f144a9a707eee99f..0000000000000000000000000000000000000000 --- a/entry/src/test/LocalUnit.test.ets +++ /dev/null @@ -1,33 +0,0 @@ -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