From bb3bea5e79599bd70522933272c667228a6c86b1 Mon Sep 17 00:00:00 2001 From: liangzhenyu123 Date: Mon, 28 Nov 2022 15:26:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liangzhenyu123 --- .../js/test/RdbstoreEncryptionJsunit.test.js | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js b/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js index 64b3805e3..57338fe92 100644 --- a/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js +++ b/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js @@ -94,7 +94,7 @@ describe('rdbEncryptTest', function () { console.info(TAG + 'afterAll') }) - console.log(TAG + "*************Unit Test Begin*************") + console.info(TAG + "*************Unit Test Begin*************") /** * @tc.name RDB encrypted test @@ -102,22 +102,15 @@ describe('rdbEncryptTest', function () { * @tc.desc RDB create encrypt db test */ it('RdbEncryptTest_0010', 0, async function (done) { - console.log(TAG + "************* RdbEncryptTest_0010 start *************") + console.info(TAG + "************* RdbEncryptTest_0010 start *************") context = ability_featureAbility.getContext() - let storePromise = data_rdb.getRdbStore(context, STORE_CONFIG_ENCRYPT, 1); - storePromise.then(async (store) => { - try { - console.log(TAG + "getRdbStore done: " + store); - } catch (err) { - expect(null).assertFail(); - } + data_rdb.getRdbStore(context, STORE_CONFIG_ENCRYPT, 1).then((store) => { + done() + expect(store != null).assertTrue(); }).catch((err) => { expect(null).assertFail(); }) - storePromise = null - - done() - console.log(TAG + "************* RdbEncryptTest_0010 end *************") + console.info(TAG + "************* RdbEncryptTest_0010 end *************") }) /** @@ -126,22 +119,17 @@ describe('rdbEncryptTest', function () { * @tc.desc RDB create unencrypted db test */ it('RdbEncryptTest_0020', 0, async function (done) { - console.log(TAG + "************* RdbEncryptTest_0020 start *************") + console.info(TAG + "************* RdbEncryptTest_0020 start *************") context = ability_featureAbility.getContext() let storePromise = data_rdb.getRdbStore(context, STORE_CONFIG_UNENCRYPT, 1); - storePromise.then(async (store) => { - try { - console.log(TAG + "getRdbStore done: " + store); - } catch (err) { - expect(null).assertFail(); - } + storePromise.then((store) => { + expect(store != null).assertTrue(); + done() }).catch((err) => { expect(null).assertFail(); }) - storePromise = null - - done() - console.log(TAG + "************* RdbEncryptTest_0020 end *************") + + console.info(TAG + "************* RdbEncryptTest_0020 end *************") }) @@ -151,14 +139,14 @@ describe('rdbEncryptTest', function () { * @tc.desc RDB Encrypt function test */ it('RdbEncryptTest_0030', 0, async function (done) { - console.log(TAG + "************* RdbEncryptTest_0030 start *************") + console.info(TAG + "************* RdbEncryptTest_0030 start *************") context = ability_featureAbility.getContext() rdbStore = await CreatRdbStore(context, STORE_CONFIG_ENCRYPT) let predicates = new data_rdb.RdbPredicates("test") predicates.equalTo("name", "zhangsan") let resultSet = await rdbStore.query(predicates) try { - console.log(TAG + "After restore resultSet query done") + console.info(TAG + "After restore resultSet query done") expect(true).assertEqual(resultSet.goToFirstRow()) const id = resultSet.getLong(resultSet.getColumnIndex("id")) const name = resultSet.getString(resultSet.getColumnIndex("name")) @@ -172,7 +160,7 @@ describe('rdbEncryptTest', function () { resultSet = null rdbStore = null done() - console.log(TAG + "************* RdbEncryptTest_0030 end *************") + console.info(TAG + "************* RdbEncryptTest_0030 end *************") }) /** @@ -181,7 +169,7 @@ describe('rdbEncryptTest', function () { * @tc.desc RDB Encrypt function test */ it('RdbEncryptTest_0040', 0, async function (done) { - console.log(TAG + "************* RdbEncryptTest_0040 start *************") + console.info(TAG + "************* RdbEncryptTest_0040 start *************") context = ability_featureAbility.getContext() rdbStore = await CreatRdbStore(context, STORE_CONFIG_ENCRYPT) rdbStore = null @@ -189,9 +177,9 @@ describe('rdbEncryptTest', function () { expect(rdbStore).assertNull done() - console.log(TAG + "************* RdbEncryptTest_0040 end *************") + console.info(TAG + "************* RdbEncryptTest_0040 end *************") }) - console.log(TAG + "*************Unit Test End*************") + console.info(TAG + "*************Unit Test End*************") } ) -- GitLab