diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js index 9341297651bec0aad4df9f94e9c1c6dd92a72d3b..4bb7bcf474e1f14cef447fff57f2d64516369e19 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js @@ -17,6 +17,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from const TIMEOUT = 5000; const EACHTIMEOUT = 500; +const ERR_JS_CREDENTIAL_NOT_EXIST = 12300102; export default function ActsAppAccountCredential() { describe('ActsAppAccountCredential', function () { function sleep(delay) { @@ -458,7 +459,7 @@ export default function ActsAppAccountCredential() { expect(err).assertEqual(null); appAccountManager.getCredential("account_name_1500", "credentialType15", (err)=>{ console.debug("====>getCredential ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); - expect(err.code == 12300019).assertEqual(true); + expect(err.code == ERR_JS_CREDENTIAL_NOT_EXIST).assertEqual(true); appAccountManager.removeAccount("account_name_1500", (err)=>{ console.debug("====>delete Account ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -485,7 +486,7 @@ export default function ActsAppAccountCredential() { } catch(err){ console.debug("====>getCredential ActsAppAccountCredential_1600 err:" + JSON.stringify(err)); - expect(err.code == 12300019).assertEqual(true); + expect(err.code == ERR_JS_CREDENTIAL_NOT_EXIST).assertEqual(true); console.debug("====>delete account ActsAppAccountCredential_1600 start===="); await appAccountManager.removeAccount("account_name_1600"); console.debug("====>ActsAppAccountCredential_1600 end===="); diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js index 1d1aff3e9ca509a8430dd9a4006270687631b4e8..79ca1a2ecc5ca64bdbfe15d2de1ef77ae777b609 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js @@ -25,7 +25,7 @@ const LENGTHLIMIT = 512; const TOKENLENGTHLIMIT = 1024; const AUTHTYPELENGTHLIMIT = 1024; const OWNERLENGTHLIMIT = 1024; - +const ERR_JS_AUTH_TYPE_NOT_FOUND = 12300107; const OWNERSELF = "com.example.actsaccountoperatetest"; export default function ActsAccountAuthToken() { describe('ActsAccountAuthToken', function () { @@ -1335,7 +1335,7 @@ export default function ActsAccountAuthToken() { await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); }catch(err){ console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); - expect(err.code == 12400004).assertEqual(true); + expect(err.code == ERR_JS_AUTH_TYPE_NOT_FOUND).assertEqual(true); } try{ console.debug("====>getAuthToken ActsAccountAuthToken_2200 start===="); diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js index 6cba698209e4f95999f802f7f3e59749c9f6e157..9f0ab901022b64f7b2ea661103664ad0b3169257 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js @@ -33,8 +33,9 @@ export default function ActsAccountAppAccess() { console.info(`sleep #{time} over ...`) }) } - beforeAll(async function (done) { - await featureAbility.startAbility( + beforeAll(async function (done) { + console.debug("====>ActsAccountAuthenticator beforeAll start===="); + await featureAbility.startAbilityForResult( { want: { @@ -47,7 +48,8 @@ export default function ActsAccountAppAccess() { }, }, ) - await sleep(1500) + await sleep(1500); + console.debug("====>ActsAccountAuthenticator beforeAll end===="); done(); }); beforeEach(async (done)=>{ @@ -619,7 +621,9 @@ export default function ActsAccountAppAccess() { expect(data.length).assertEqual(1) } catch(err) { console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); + await appAccountManager.removeAccount(name); expect(err).assertEqual(null) + done(); } try{ await appAccountManager.removeAccount(name) @@ -654,7 +658,9 @@ export default function ActsAccountAppAccess() { expect(data.length).assertEqual(3) } catch(err) { console.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); + await appAccountManager.removeAccount(name); expect(err).assertEqual(null) + done(); } try{ await appAccountManager.removeAccount(name) @@ -690,7 +696,9 @@ export default function ActsAccountAppAccess() { expect(data.length).assertEqual(1) } catch(err) { console.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err)); + await appAccountManager.removeAccount(name); expect(err).assertEqual(null) + done(); } try{ await appAccountManager.removeAccount(name) diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js index 4a6d48f991e207fd3d7b0779182a4db05342756e..c0ca011f263c946a744fe7d09c4025f0beab6b5b 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js @@ -19,7 +19,7 @@ const NAMELIMIT = 512; const LENGTHLIMIT = 1024; const ERR_PARAMETER_CHECK_FAILD =401 const ERR_INVALID_PARAMETER = 12300002 -const ERR_ACCOUNT_EXIST = 12300008 +const ERR_ACCOUNT_EXIST = 12300004 const createAccountOptions = {customData:{age:'12'}} //k and v length 1024 ,k and v size 1024 const createAccountOptionsDiff = {customData:{sex:'male'}} export default function ActsAccountCreateAccount() { @@ -521,7 +521,7 @@ export default function ActsAccountCreateAccount() { expect(err).assertEqual(null); appAccountManager.createAccount("account_name_callback_same", createAccountOptionsDiff, (err)=>{ console.debug("====>add account second time ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(12300008); + expect(err.code).assertEqual(ERR_ACCOUNT_EXIST); appAccountManager.removeAccount("account_name_callback_same", (err)=>{ console.debug("====>delete Account ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -548,7 +548,7 @@ export default function ActsAccountCreateAccount() { } catch(err){ console.debug("====>add account for the second time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(12300008); + expect(err.code).assertEqual(ERR_ACCOUNT_EXIST); appAccountManager.removeAccount("account_name_promise_same"); console.debug("====>ActsAccountCreateAccount_2400 end===="); done(); diff --git a/account/appaccount/actsaccounttest/src/main/config.json b/account/appaccount/actsaccounttest/src/main/config.json index 7437985496e3339bc3c4b88ec468662e167b464c..b758218b02a4acd78fac346de0f284cd9f07e129 100644 --- a/account/appaccount/actsaccounttest/src/main/config.json +++ b/account/appaccount/actsaccounttest/src/main/config.json @@ -17,9 +17,8 @@ "package": "com.example.actsaccounttest", "name": ".MyApplication", "deviceType": [ - "tablet", - "default", - "phone" + "tablet", + "default" ], "distro": { "deliveryWithInstall": true, diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js index 6e1179359c0340de16ce301a9870cb53f219f42b..c5186cf9c4537f9ffa869d250ee6ac168b7816c7 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js @@ -31,15 +31,15 @@ export default { await accountMgr.setAppAccess("zhangsan", "com.example.actsaccounttest", true); console.info('====>ServiceAbility setAppAccess actsaccountoperatetest zhangsan'); await accountMgr.setAppAccess("zhangsan", "com.example.actsaccountoperatetest", true); - console.info('====>ServiceAbility lcc addAccount 02 onStart'); + console.info('====>ServiceAbility addAccount 02 onStart'); accountMgr.createAccount("lisi", async (err)=>{ console.info('====>ServiceAbility setAppAccess actsaccounttest lisi'); await accountMgr.setAppAccess("lisi", "com.example.actsaccounttest", true); console.info('====>ServiceAbility setAppAccess actsaccountoperatetest lisi'); await accountMgr.setAppAccess("lisi", "com.example.actsaccountoperatetest", true); - console.info('====>ServiceAbility lcc addAccount 03 onStart'); + console.info('====>ServiceAbility addAccount 03 onStart'); accountMgr.createAccount("wangwu", async (err)=>{ - console.info('====>ServiceAbility lcc enableAppAccess 03 onStart'); + console.info('====>ServiceAbility enableAppAccess 03 onStart'); console.info('====>ServiceAbility setAppAccess actsaccounttest wangwu'); await accountMgr.setAppAccess("wangwu", "com.example.actsaccounttest", true) console.info('====>ServiceAbility setAppAccess actsaccountoperatetest wangwu');