From 541aa0576385a70203fde91099672e84a2f002ab Mon Sep 17 00:00:00 2001 From: gwx1146427 Date: Fri, 3 Mar 2023 15:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90account=E3=80=91=E3=80=90master?= =?UTF-8?q?=E3=80=91=E4=BF=AE=E6=94=B9JSAPI=E7=9A=84UN=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gwx1146427 --- .../src/main/js/test/ActsDSGetSet.test.js | 39 ++++++++++++------- .../src/main/js/test/OsAccount.test.js | 2 +- .../src/main/js/test/Authenticator.test.js | 2 +- .../src/main/js/test/Authenticator.test.js | 2 +- .../main/js/MainAbility/pages/index/index.js | 4 +- 5 files changed, 30 insertions(+), 19 deletions(-) mode change 100755 => 100644 account/OsAccountTest_js/src/main/js/test/OsAccount.test.js diff --git a/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js b/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js index ea0da9a8b..968c5f106 100644 --- a/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js +++ b/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js @@ -122,25 +122,31 @@ export default function ActsDAGetSetTest() { scalableData:{} }; accountAbility.setOsAccountDistributedInfo(obj).then(function () { - accountAbility.getOsAccountDistributedInfo(function (data) { + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug('====>setOsAccountDistributedInfo_test001 ccerr:' + JSON.stringify(err)) console.debug('====>setOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) expect(data.name).assertEqual('ZhangSan') - expect(data.id).assertEqual('12345') + expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') let obj = { id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGOUT' }; - accountAbility.setOsAccountDistributedInfo(obj).then(function (err) { - expect(err).assertEqual(null) - }); + accountAbility.setOsAccountDistributedInfo(obj).then(function () { + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug('====>setOsAccountDistributedInfo_test001 get ccerr:' + JSON.stringify(err)) + console.debug('====>setOsAccountDistributedInfo_test001 get ccdata:' + JSON.stringify(data)) + expect(err).assertEqual(null) + done(); + }) + }).catch((err) => { + console.debug('====>setOsAccountDistributedInfo_test001 ccerr:' + JSON.stringify(err)) + expect().assertFail(); + done(); + }) }); }); - accountAbility.getOsAccountDistributedInfo(function (data) { - console.debug('====>setOsAccountDistributedInfo_test001 get data:' + JSON.stringify(data)) - expect(data).assertEqual(null) - done(); - }) + }) /** @@ -156,9 +162,11 @@ export default function ActsDAGetSetTest() { event: 'Ohos.account.event.LOGIN', scalableData:{} }; - accountAbility.setOsAccountDistributedInfo(obj, function () { + accountAbility.setOsAccountDistributedInfo(obj, function (err) { + console.debug('====>setOsAccountDistributedInfo_test002 ccerr callback:' + JSON.stringify(err)) accountAbility.getOsAccountDistributedInfo(function (err, data) { - console.debug("====>setOsAccountDistributedInfo_test002 data:" + JSON.stringify(data)) + console.debug('====>setOsAccountDistributedInfo_test002 get ccerr:' + JSON.stringify(err)) + console.debug("====>setOsAccountDistributedInfo_test002 get data:" + JSON.stringify(data)) expect(data.name).assertEqual('ZhangSan') expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') let obj = { @@ -166,8 +174,11 @@ export default function ActsDAGetSetTest() { name: 'ZhangSan', event: 'Ohos.account.event.LOGOUT' }; - accountAbility.setOsAccountDistributedInfo(obj).then(function (data) { - expect(data).assertEqual(null) + accountAbility.setOsAccountDistributedInfo(obj).then(function () { + done(); + }).catch((err) => { + console.debug('====>setOsAccountDistributedInfo_test002 set ccerr:' + JSON.stringify(err)) + expect().assertFail(); done(); }); }); diff --git a/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js b/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js old mode 100755 new mode 100644 index 4e49a4422..9eb458b47 --- a/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js +++ b/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js @@ -124,7 +124,7 @@ export default function AccountTest() { scalableData:data }; accountAbility.updateOsAccountDistributedInfo(obj).then(function () { - accountAbility.queryOsAccountDistributedInfo(function (data) { + accountAbility.queryOsAccountDistributedInfo(function (err, data) { console.debug('====>account_updateOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) expect(data.name).assertEqual('ZhangSan') expect(data.id).assertEqual('12345') 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 9f0ab9010..e1bce4553 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js @@ -14,7 +14,7 @@ */ import account from '@ohos.account.appAccount' import featureAbility from '@ohos.ability.featureAbility' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' const NAMELIMIT = 512; const LENGTHLIMIT = 1024; diff --git a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js index 5c6837b44..9a5e705b9 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js @@ -14,7 +14,7 @@ */ import account from '@ohos.account.appAccount' import featureAbility from '@ohos.ability.featureAbility' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' const NAMELIMIT = 512; const LENGTHLIMIT = 1024; 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 c5186cf9c..6163302b1 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 @@ -19,10 +19,10 @@ export default { data: { title: "Hello World" }, - onInit() { + onShow() { this.title = this.$t('strings.world'); }, - onShow() { + onInit() { console.info('====>ServiceAbility onStart'); var accountMgr = account_appAccount.createAppAccountManager(); accountMgr.createAccount("zhangsan", async(data)=>{ -- GitLab