From f751b194e56bc0533dc0224b8fd6c629553887fb Mon Sep 17 00:00:00 2001 From: yanglifeng1217 Date: Wed, 14 Dec 2022 15:55:11 +0800 Subject: [PATCH] Signed-off-by: yanglifeng1217 --- .../js/test/DeviceKvStoreKVCallbackJsTest.js | 7 +- .../js/test/DeviceKvStoreKVPromiseJsTest.js | 7 +- .../main/js/test/KvManagerKVCallbackJsTest.js | 86 ++++++++++++++++++- .../main/js/test/KvManagerKVPromiseJsTest.js | 85 ++++++++---------- .../js/test/KvStoreBackupCallbackJsTest.js | 23 ++--- .../js/test/KvStoreBackupPromiseJsTest.js | 23 ++--- .../main/js/test/KvStoreResultSetKVJsTest.js | 7 +- .../hap/src/main/js/test/QueryKVJsTest.js | 8 +- .../hap/src/main/js/test/SchemaJsTest.js | 12 +-- .../js/test/SingleKvStoreKVCallbackJsTest.js | 7 +- .../js/test/SingleKvStoreKVPromiseJsTest.js | 7 +- 11 files changed, 145 insertions(+), 127 deletions(-) diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js index a70c8fdaf..67bc75cc9 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js @@ -76,12 +76,7 @@ describe('deviceKvStoreCallbackTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config); await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { kvStore = store; console.info('beforeAll getKVStore for getDeviceId success'); diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js index b18e7a35a..6a2869a9e 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js @@ -76,12 +76,7 @@ describe('deviceKvStorePromiseTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config); await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { kvStore = store; console.info('beforeAll getKVStore for getDeviceId success'); diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js index e86aefe06..45504a80c 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js @@ -42,11 +42,9 @@ describe('kvManagerCallbackTest', function () { beforeAll(async function (done) { console.info('beforeAll'); - await factory.createKVManager(config, function (err, manager) { - kvManager = manager; - done(); - }); + kvManager = factory.createKVManager(config); console.info('beforeAll end'); + done(); }) afterAll(async function (done) { @@ -498,5 +496,85 @@ describe('kvManagerCallbackTest', function () { done(); } }) + + /** + * @tc.number SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0100 + * @tc.desc Test Js Api createKVManager() testcase 001 + * @tc.type: FUNC + * @tc.name Test Js Api createKVManager() testcase 001 + */ + it('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0100', 0, async function (done) { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0100 start'); + let kvManagerConfig = { + bundleName : [TEST_BUNDLE_NAME], + context: context + } + try{ + factory.createKVManager(kvManagerConfig); + expect(false).assertTrue(); + }catch(err){ + console.info(`Create kvManager error: error code is ${err.code}, error message is ${err.message}`); + expect(err.code).assertEqual("401"); + } + done(); + }) + + /** + * @tc.number SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0200 + * @tc.desc Test Js Api createKVManager() testcase 002 + * @tc.type: FUNC + * @tc.name Test Js Api createKVManager() testcase 002 + */ + it('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0200', 0, async function (done) { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0200 start '); + let kvManagerConfig = { + bundleName : TEST_BUNDLE_NAME, + context: "context" + } + try{ + factory.createKVManager(kvManagerConfig); + expect(false).assertTrue(); + }catch(err){ + console.info(`Create kvManager error: error code is ${err.code}, error message is ${err.message}`); + expect(err.code).assertEqual("401"); + } + done(); + }) + + /** + * @tc.number SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0300 + * @tc.desc Test Js Api createKVManager() testcase 003 + * @tc.type: FUNC + * @tc.name Test Js Api createKVManager() testcase 003 + */ + it('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0300', 0, async function (done) { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0300 start '); + try{ + factory.createKVManager("kvManagerConfig"); + expect(false).assertTrue(); + }catch(err){ + console.info(`Create kvManager error: error code is ${err.code}, error message is ${err.message}`); + expect(err.code).assertEqual("401"); + } + done(); + }) + + /** + * @tc.number SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0400 + * @tc.desc Test Js Api createKVManager() testcase 004 + * @tc.type: FUNC + * @tc.name Test Js Api createKVManager() testcase 004 + */ + it('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0400', 0, async function (done) { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_0400 start '); + try{ + factory.createKVManager(); + expect(false).assertTrue(); + }catch(err){ + console.info(`Create kvManager error: error code is ${err.code}, error message is ${err.message}`); + expect(err.code).assertEqual("401"); + } + done(); + }) }) } \ No newline at end of file diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js index c7b019ee3..68e3a2bc1 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js @@ -45,17 +45,12 @@ describe('KVManagerPromiseTest', function () { beforeAll(async function (done) { console.info('beforeAll'); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { - console.info("beforeAll getKVStore success"); - kvStoreNew = store; - }).catch((err) => { - console.info("beforeAll getKVStore err: " + JSON.stringify(err)); - }); + kvManager = factory.createKVManager(config) + kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { + console.info("beforeAll getKVStore success"); + kvStoreNew = store; }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); + console.info("beforeAll getKVStore err: " + JSON.stringify(err)); }); console.info('beforeAll end'); done(); @@ -394,36 +389,30 @@ describe('KVManagerPromiseTest', function () { context:context } try { - await factory.createKVManager(config).then(async (manager) => { - kvManager = manager; - expect(manager !=null).assertTrue(); - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 createKVManager success'); - await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { - console.info("testcreateKVManager001 getKVStore success"); - await store.put(STORE_KEY, STORE_VALUE).then(async (data) => { - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data success'); - await store.get(STORE_KEY).then((data) => { - console.info("testcreateKVManager001 get data success"); - expect(data).assertEqual(STORE_VALUE); - }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 get data err' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config) + kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { + console.info("testcreateKVManager001 getKVStore success"); + store.put(STORE_KEY, STORE_VALUE).then(async (data) => { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data success'); + store.get(STORE_KEY).then((data) => { + console.info("testcreateKVManager001 get data success"); + expect(data).assertEqual(STORE_VALUE); + done(); }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data err' + `, error code is ${err.code}, message is ${err.message}`); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 get data err' + `, error code is ${err.code}, message is ${err.message}`); }); }).catch((err) => { - console.info("testcreateKVManager001 getKVStore err: " + JSON.stringify(err)); - expect(null).assertFail(); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data err' + `, error code is ${err.code}, message is ${err.message}`); }); }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - expect(null).assertFail() + console.info("testcreateKVManager001 getKVStore err: " + JSON.stringify(err)); + expect(null).assertFail(); }); }catch (e) { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 promise delete fail err' + `, error code is ${err.code}, message is ${err.message}`); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 promise delete fail err' + `, error code is ${e.code}, message is ${e.message}`); expect(null).assertFail(); } - done(); + }) /** @@ -439,35 +428,31 @@ describe('KVManagerPromiseTest', function () { context:contextApplication } try { - await factory.createKVManager(config).then(async (manager) => { - kvManager = manager; - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 createKVManager success'); - await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { - console.info("testcreateKVManager002 getKVStore success"); - await store.put(STORE_KEY, STORE_VALUE).then(async (data) => { - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data success'); - await store.get(STORE_KEY).then((data) => { - console.info("testcreateKVManager002 get data success"); - expect(data).assertEqual(STORE_VALUE); - }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 get data err' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config) + kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { + console.info("testcreateKVManager002 getKVStore success"); + store.put(STORE_KEY, STORE_VALUE).then(async (data) => { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data success'); + store.get(STORE_KEY).then((data) => { + console.info("testcreateKVManager002 get data success"); + expect(data).assertEqual(STORE_VALUE); + done(); }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data err' + `, error code is ${err.code}, message is ${err.message}`); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 get data err' + `, error code is ${err.code}, message is ${err.message}`); }); }).catch((err) => { - console.info("testcreateKVManager002 getKVStore err: " + JSON.stringify(err)); - expect(null).assertFail(); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data err' + `, error code is ${err.code}, message is ${err.message}`); }); + }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - expect(null).assertFail() + console.info("testcreateKVManager002 getKVStore err: " + JSON.stringify(err)); + expect(null).assertFail(); }); }catch (e) { console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 promise delete fail err' + `, error code is ${err.code}, message is ${err.message}`); expect(null).assertFail(); } - done(); + }) }) } \ No newline at end of file diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js index 50aab867b..56374e094 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js @@ -35,25 +35,16 @@ function sleep(ms) { function publicgetKvStore(optionsp){ console.log(`Test getKvStore `) return new Promise(function(resolve, reject) { - distributedData.createKVManager(mKVMgrConfig, (err, data) => { - console.info('Test createKVManager begin') + kvManager = distributedData.createKVManager(mKVMgrConfig); + kvManager.getKVStore(STORE_ID, optionsp, (err, data) => { + console.info('Test getKVStore begin') if (err) { - console.info('Test createKVManager err = ' + err ); + console.info('Test getKVStore err = ' + err); reject(err); } - console.info('Test createKVManager data = ' + data); - - kvManager = data; - data.getKVStore(STORE_ID, optionsp, (err, data) => { - console.info('Test getKVStore begin') - if (err) { - console.info('Test getKVStore err = ' + err); - reject(err); - } - console.info('Test getKVStore data = ' + data); - kvStore = data; - resolve(data); - }); + console.info('Test getKVStore data = ' + data); + kvStore = data; + resolve(data); }); }) } diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js index a60efdf90..ec4c91511 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js @@ -32,25 +32,16 @@ let mKVMgrConfig = { function publicgetKvStore(optionsp){ console.log(`Test getKvStore `) return new Promise(function(resolve, reject) { - distributedData.createKVManager(mKVMgrConfig, (err, data) => { - console.info('Test createKVManager begin') + kvManager = distributedData.createKVManager(mKVMgrConfig); + kvManager.getKVStore(STORE_ID, optionsp, (err, data) => { + console.info('Test getKVStore begin') if (err) { - console.info('Test createKVManager err = ' + err ); + console.info('Test getKVStore err = ' + err); reject(err); } - console.info('Test createKVManager data = ' + data); - - kvManager = data; - data.getKVStore(STORE_ID, optionsp, (err, data) => { - console.info('Test getKVStore begin') - if (err) { - console.info('Test getKVStore err = ' + err); - reject(err); - } - console.info('Test getKVStore data = ' + data); - kvStore = data; - resolve(data); - }); + console.info('Test getKVStore data = ' + data); + kvStore = data; + resolve(data); }); }) } diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js index 20186700b..23230756b 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js @@ -42,12 +42,7 @@ export default function KvStoreResultSetTest(){ beforeAll(async function (done) { console.info('beforeAll'); console.info('beforeAll config:' + JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config); await kvManager.getAllKVStoreId(TEST_BUNDLE_NAME).then(async (data) => { console.info('beforeAll getAllKVStoreId size = ' + data.length); for (var i = 0; i < data.length; i++) { diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js index d2fe2745f..e8dc8e2bc 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js @@ -1932,12 +1932,12 @@ describe('queryTest', function() { }) /** - * @tc.number: SUB_DDM_DKV_QUERY_PREFIXKEY_PROMISE_0200 + * @tc.number: SUB_DDM_DKV_QUERY_SETSUGGESTINDEX_PROMISE_0200 * @tc.desc: Test Js Api Query.SetSuggestIndex() testcase 002 * @tc.type: FUNC * @tc.name Test Js Api Query.SetSuggestIndex() testcase 002 */ - it('SUB_DDM_DKV_QUERY_PREFIXKEY_PROMISE_0200', 0, async function(done) { + it('SUB_DDM_DKV_QUERY_SETSUGGESTINDEX_PROMISE_0200', 0, async function(done) { var query = null; try { query = new ddm.Query(); @@ -1953,12 +1953,12 @@ describe('queryTest', function() { }) /** - * @tc.number: SUB_DDM_DKV_QUERY_PREFIXKEY_PROMISE_0300 + * @tc.number: SUB_DDM_DKV_QUERY_SETSUGGESTINDEX_PROMISE_0300 * @tc.desc: Test Js Api Query.SetSuggestIndex() testcase 003 * @tc.type: FUNC * @tc.name Test Js Api Query.SetSuggestIndex() testcase 003 */ - it('SUB_DDM_DKV_QUERY_PREFIXKEY_PROMISE_0300', 0, async function(done) { + it('SUB_DDM_DKV_QUERY_SETSUGGESTINDEX_PROMISE_0300', 0, async function(done) { var query = null; try { query = new ddm.Query(); diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js index 424bd5a80..d0993bdd6 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js @@ -104,18 +104,14 @@ describe('schemaTest', function() { beforeAll(async function (done) { try { - console.info("beforeAll: createKVManager (single) with " + JSON.stringify(options)); - await ddm.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.info('beforeAll createKVManager err ' + err); - }); + console.info("beforeAll: createKVManager (single) with " + JSON.stringify(config)); + kvManager = ddm.createKVManager(config); + done(); } catch (e) { console.info("fail on exception: " + e); expect(null).assertFail(); } - done(); + }) afterAll(async function (done) { diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js index 134cdf6f8..ac6b12366 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js @@ -75,11 +75,8 @@ describe('SingleKvStoreCallbackTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config, function (err, manager) { - kvManager = manager; - console.info('beforeAll createKVManager success'); - done(); - }) + kvManager = factory.createKVManager(config); + done(); }) afterAll(async function (done) { diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js index 6905f774a..68b343c7c 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js @@ -75,12 +75,7 @@ describe('SingleKvStorePromiseTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config); console.info('beforeAll end'); done(); }) -- GitLab