diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js index dd89d0c57749377fc175bffdcfd69e9e45bfca65..23ba58d28d70d1a90f88134905096611bc7ebdef 100644 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js @@ -16,10 +16,20 @@ import osaccount from '@ohos.account.osAccount' import bundle from '@ohos.bundle' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -const ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR = 4653057; export default function ActsOsAccountThirdPartyTest_third_2() { describe('ActsOsAccountThirdPartyTest_third_2', function () { - + afterEach(async function (done) { + console.debug("====>afterEach start===="); + var osAccountManager = osaccount.getAccountManager(); + var accounts = await osAccountManager.queryAllCreatedOsAccounts() + for (i=0;i{ console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); expect(localId).assertEqual(null); console.debug("====>ActsOsAccountGetIdFormUid_0300 end===="); done(); @@ -100,7 +110,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid); }catch(err){ console.debug("====>get localId by uid err:" +JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountGetIdFormUid_0400 end===="); done(); } @@ -119,7 +129,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{ console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); expect(localId).assertEqual(null); console.debug("====>ActsOsAccountGetIdFormUid_0500 end===="); done(); @@ -140,7 +150,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid); }catch(err){ console.debug("====>get localId by uid err:" +JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountGetIdFormUid_0600 end===="); done(); } @@ -387,7 +397,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { var osAccountManager = osaccount.getAccountManager(); console.debug("====>get AccountManager finish===="); var localId; - var OsAccountInfo = await osAccountManager.createOsAccount("accountIdSerialB", osaccount.OsAccountType.Guest); + var OsAccountInfo = await osAccountManager.createOsAccount("accountIdSerialB", osaccount.OsAccountType.GUEST); console.debug("====>create os account OsAccountInfo: " + JSON.stringify(OsAccountInfo)); expect(OsAccountInfo.localName).assertEqual("accountIdSerialB"); localId = OsAccountInfo.localId; @@ -505,7 +515,8 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.queryActivatedOsAccountIds((err,dataArray)=>{ console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 err :" + JSON.stringify(err)); expect(err).assertEqual(null) - console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray" + dataArray.length); + console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray:" + dataArray); + expect(dataArray.length).assertEqual(1) done(); }) }) @@ -518,8 +529,9 @@ export default function ActsOsAccountThirdPartyTest_third_2() { it('ActsOsAccountQueryActivedOsAccountIds_0200', 0, async function (done) { console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 start===="); var osAccountManager = osaccount.getAccountManager(); - osAccountManager.queryActivatedOsAccountIds().then((data)=>{ - console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 data" + JSON.stringify(data)) + osAccountManager.queryActivatedOsAccountIds().then((dataArray)=>{ + console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 data" + JSON.stringify(dataArray)) + expect(dataArray.length).assertEqual(1) done(); }).catch((err)=>{ console.info("====>ActsOsAccountQueryActivedOsAccountIds_0200 err " + JSON.stringify(err)); diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js index b4966c76e74ebee0cb6e4e64678b01500c844b17..969c36f94771daca225f0e4170097b9a3aecbfe9 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js @@ -17,8 +17,6 @@ import distributedAccount from '@ohos.account.distributedAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' const TIMEOUT = 1000; -const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR = 4587542; -const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR = 4587545; export default function ActsOsAccountThirdPartyTest_third_1() { describe('ActsOsAccountThirdPartyTest_third_1', function () { @@ -132,7 +130,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var nonExistLocalId = 1000; AccountManager.isOsAccountActived(nonExistLocalId, (err)=>{ console.debug("====>isOsAccountActived err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsActived_0300 end"); done(); }) @@ -153,7 +151,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { } catch(err){ console.debug("====>isOsAccountActived err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsActived_0400 end"); done(); } @@ -439,7 +437,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var osAccountLocalId = 1000; AccountManager.isOsAccountVerified(osAccountLocalId, (err)=>{ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsVerified_0900 end===="); done(); }) @@ -460,7 +458,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { } catch(err){ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsVerified_1000 end===="); done(); }