From 24459f983e3a565f8c6fc40c175541f622b1806c Mon Sep 17 00:00:00 2001 From: huangjiaqi Date: Fri, 31 Dec 2021 13:44:40 +0800 Subject: [PATCH] distrubuteddatamgr js api8 xts testcases. Signed-off-by: xsterling --- .../test/DeviceKvStoreCallbackJsunit.test.js | 424 +++++++++++- .../test/DeviceKvStorePromiseJsunit.test.js | 459 ++++++++++++- .../js/default/test/FieldNodeJsunit.test.js | 34 +- .../test/KvManagerCallbackJsunit.test.js | 144 +++- .../test/KvManagerPromiseJsunit.test.js | 186 +++++- .../test/KvStoreResultSetJsunit.test.js | 286 +++++++- .../hap/src/main/js/default/test/List.test.js | 2 +- .../main/js/default/test/QueryJsunit.test.js | 631 ++++++++++++++++-- .../main/js/default/test/SchemaJsunit.test.js | 257 +++++-- .../test/SingleKvStoreCallbackJsunit.test.js | 435 +++++++++++- .../test/SingleKvStoreEnumJsunit.test.js | 220 +++++- .../test/SingleKvStorePromiseJsunit.test.js | 468 ++++++++++++- 12 files changed, 3316 insertions(+), 230 deletions(-) diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js index 62da9477f..88d1c163c 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -79,19 +79,35 @@ describe('DeviceKvStoreCallbackTest', function () { }).catch((err) => { console.log('beforeAll createKVManager err ' + err); }); - // get localDeviceId - put, get deviceId on dataChange().. await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { kvStore = store; - console.log('beforeAll getKVStore success'); + console.log('beforeAll getKVStore for getDeviceId success'); }).catch((err) => { console.log('beforeAll getKVStore err ' + err); }); - kvStore.on('dataChange', 0, function (data) { - console.log('beforeAll on ' + JSON.stringify(data)) - localDeviceId = data.deviceId; - expect(localDeviceId != null).assertTrue(); + var getDeviceId = new Promise((resolve, reject) => { + kvStore.on('dataChange', 0, function (data) { + console.log('beforeAll on data change: ' + JSON.stringify(data)); + resolve(data.deviceId); + }); + kvStore.put("getDeviceId", "byPut").then((data) => { + console.log('beforeAll put success'); + expect(data == undefined).assertTrue(); + }); + setTimeout(() => { + reject(new Error('not resolved in 2 second, reject it.')) + }, 2000); }); - await kvStore.put("getDeviceId", "byPut"); + await getDeviceId.then(function(deviceId) { + console.log('beforeAll getDeviceId ' + JSON.stringify(deviceId)); + localDeviceId = deviceId; + }).catch((error) => { + console.log('beforeAll can NOT getDeviceId, fail: ' + error); + expect(null).assertFail(); + }); + await kvManager.closeKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID, kvStore); + await kvManager.deleteKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID); + kvStore = null; console.log('beforeAll end'); done(); }) @@ -123,6 +139,11 @@ describe('DeviceKvStoreCallbackTest', function () { }); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTSTRING_1100 + * @tc.name [JS-API8]DeviceKvStore.Put(String) + * @tc.desc Test Js Api DeviceKvStore.Put(String) testcase 101 + */ it('testDeviceKvStorePutString101', 0, async function (done) { console.log('testDeviceKvStorePutString101'); try { @@ -142,6 +163,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTSTRING_1200 + * @tc.name [JS-API8]DeviceKvStore.Put(String) + * @tc.desc Test Js Api DeviceKvStore.Put(String) testcase 102 + */ it('testDeviceKvStorePutString102', 0, async function (done) { console.log('testDeviceKvStorePutString102'); try { @@ -165,6 +191,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETSTRING_1100 + * @tc.name [JS-API8]DeviceKvStore.Get(String) + * @tc.desc Test Js Api DeviceKvStore.Get(String) testcase 101 + */ it('testDeviceKvStoreGetString101', 0, async function (done) { console.log('testDeviceKvStoreGetString101'); try{ @@ -184,6 +215,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETSTRING_1200 + * @tc.name [JS-API8]DeviceKvStore.Get(String) + * @tc.desc Test Js Api DeviceKvStore.Get(String) testcase 102 + */ it('testDeviceKvStoreGetString102', 0, async function (done) { console.log('testDeviceKvStoreGetString102'); try{ @@ -203,6 +239,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_1100 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 101 + */ it('testDeviceKvStorePutInt101', 0, async function (done) { console.log('testDeviceKvStorePutInt101'); try { @@ -222,6 +263,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_1200 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 102 + */ it('testDeviceKvStorePutInt102', 0, async function (done) { console.log('testDeviceKvStorePutInt102'); try { @@ -242,6 +288,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_1300 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 103 + */ it('testDeviceKvStorePutInt103', 0, async function (done) { console.log('testDeviceKvStorePutInt103'); try { @@ -262,6 +313,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_1400 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 104 + */ it('testDeviceKvStorePutInt104', 0, async function (done) { console.log('testDeviceKvStorePutInt104'); try { @@ -282,6 +338,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETINT_1100 + * @tc.name [JS-API8]DeviceKvStore.Get(Int) + * @tc.desc Test Js Api DeviceKvStore.Get(Int) testcase 101 + */ it('testDeviceKvStoreGetInt101', 0, async function (done) { console.log('testDeviceKvStoreGetInt101'); try { @@ -301,6 +362,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETINT_1200 + * @tc.name [JS-API8]DeviceKvStore.Get(Int) + * @tc.desc Test Js Api DeviceKvStore.Get(Int) testcase 102 + */ it('testDeviceKvStoreGetInt102', 0, async function (done) { console.log('testDeviceKvStoreGetInt102'); try { @@ -320,6 +386,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBOOL_1100 + * @tc.name [JS-API8]DeviceKvStore.Put(Bool) + * @tc.desc Test Js Api DeviceKvStore.Put(Bool) testcase 101 + */ it('testDeviceKvStorePutBool101', 0, async function (done) { console.log('testDeviceKvStorePutBool101'); try { @@ -335,6 +406,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETBOOL_1100 + * @tc.name [JS-API8]DeviceKvStore.Get(Bool) + * @tc.desc Test Js Api DeviceKvStore.Get(Bool) testcase 101 + */ it('testDeviceKvStoreGetBool101', 0, async function (done) { console.log('testDeviceKvStoreGetBool101'); try { @@ -354,6 +430,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETBOOL_1200 + * @tc.name [JS-API8]DeviceKvStore.Get(Bool) + * @tc.desc Test Js Api DeviceKvStore.Get(Bool) testcase 102 + */ it('testDeviceKvStoreGetBool102', 0, async function (done) { console.log('testDeviceKvStoreGetBool102'); try { @@ -373,6 +454,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTFLOAT_1100 + * @tc.name [JS-API8]DeviceKvStore.Put(Float) + * @tc.desc Test Js Api DeviceKvStore.Put(Float) testcase 101 + */ it('testDeviceKvStorePutFloat101', 0, async function (done) { console.log('testDeviceKvStorePutFloat101'); try { @@ -388,6 +474,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTFLOAT_1200 + * @tc.name [JS-API8]DeviceKvStore.Put(Float) + * @tc.desc Test Js Api DeviceKvStore.Put(Float) testcase 102 + */ it('testDeviceKvStorePutFloat102', 0, async function (done) { console.log('testDeviceKvStorePutFloat102'); try { @@ -409,6 +500,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTFLOAT_1300 + * @tc.name [JS-API8]DeviceKvStore.Put(Float) + * @tc.desc Test Js Api DeviceKvStore.Put(Float) testcase 103 + */ it('testDeviceKvStorePutFloat103', 0, async function (done) { console.log('testDeviceKvStorePutFloat103'); try { @@ -430,6 +526,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTFLOAT_1400 + * @tc.name [JS-API8]DeviceKvStore.Put(Float) + * @tc.desc Test Js Api DeviceKvStore.Put(Float) testcase 104 + */ it('testDeviceKvStorePutFloat104', 0, async function (done) { console.log('testDeviceKvStorePutFloat104'); try { @@ -451,6 +552,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETFLOAT_1100 + * @tc.name [JS-API8]DeviceKvStore.Get(Float) + * @tc.desc Test Js Api DeviceKvStore.Get(Float) testcase 101 + */ it('testDeviceKvStoreGetFloat101', 0, async function (done) { console.log('testDeviceKvStoreGetFloat101'); try { @@ -470,6 +576,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETESTRING_1100 + * @tc.name [JS-API8]DeviceKvStore.DeleteString() + * @tc.desc Test Js Api DeviceKvStore.DeleteString testcase 101 + */ it('testDeviceKvStoreDeleteString101', 0, async function (done) { console.log('testDeviceKvStoreDeleteString101'); try { @@ -489,6 +600,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETESTRING_1200 + * @tc.name [JS-API8]DeviceKvStore.DeleteString() + * @tc.desc Test Js Api DeviceKvStore.DeleteString testcase 102 + */ it('testDeviceKvStoreDeleteString102', 0, async function (done) { console.log('testDeviceKvStoreDeleteString102'); try { @@ -508,6 +624,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEINT_1100 + * @tc.name [JS-API8]DeviceKvStore.DeleteInt() + * @tc.desc Test Js Api DeviceKvStore.DeleteInt testcase 101 + */ it('testDeviceKvStoreDeleteInt101', 0, async function (done) { console.log('testDeviceKvStoreDeleteInt101'); try{ @@ -527,6 +648,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEINT_1200 + * @tc.name [JS-API8]DeviceKvStore.DeleteInt() + * @tc.desc Test Js Api DeviceKvStore.DeleteInt testcase 102 + */ it('testDeviceKvStoreDeleteInt102', 0, async function (done) { console.log('testDeviceKvStoreDeleteInt102'); try{ @@ -546,6 +672,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEFLOAT_1100 + * @tc.name [JS-API8]DeviceKvStore.DeleteFloat() + * @tc.desc Test Js Api DeviceKvStore.DeleteFloat testcase 101 + */ it('testDeviceKvStoreDeleteFloat101', 0, async function (done) { console.log('testDeviceKvStoreDeleteFloat101'); try{ @@ -565,6 +696,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEFLOAT_1200 + * @tc.name [JS-API8]DeviceKvStore.DeleteFloat() + * @tc.desc Test Js Api DeviceKvStore.DeleteFloat testcase 102 + */ it('testDeviceKvStoreDeleteFloat102', 0, async function (done) { console.log('testDeviceKvStoreDeleteFloat102'); try{ @@ -584,6 +720,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBOOL_1100 + * @tc.name [JS-API8]DeviceKvStore.DeleteBool() + * @tc.desc Test Js Api DeviceKvStore.DeleteBool testcase 101 + */ it('testDeviceKvStoreDeleteBool101', 0, async function (done) { console.log('testDeviceKvStoreDeleteBool101'); try{ @@ -603,6 +744,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBOOL_1200 + * @tc.name [JS-API8]DeviceKvStore.DeleteBool() + * @tc.desc Test Js Api DeviceKvStore.DeleteBool testcase 102 + */ it('testDeviceKvStoreDeleteBool102', 0, async function (done) { console.log('testDeviceKvStoreDeleteBool102'); try{ @@ -622,6 +768,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONCHANGE_1100 + * @tc.name [JS-API8]DeviceKvStore.OnChange() + * @tc.desc Test Js Api DeviceKvStore.OnChange testcase 101 + */ it('testDeviceKvStoreOnChange101', 0, async function (done) { console.log('testDeviceKvStoreOnChange101'); try { @@ -641,6 +792,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONCHANGE_1200 + * @tc.name [JS-API8]DeviceKvStore.OnChange() + * @tc.desc Test Js Api DeviceKvStore.OnChange testcase 102 + */ it('testDeviceKvStoreOnChange102', 0, async function (done) { console.log('testDeviceKvStoreOnChange102'); try { @@ -660,6 +816,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONCHANGE_1300 + * @tc.name [JS-API8]DeviceKvStore.OnChange() + * @tc.desc Test Js Api DeviceKvStore.OnChange testcase 103 + */ it('testDeviceKvStoreOnChange103', 0, async function (done) { console.log('testDeviceKvStoreOnChange103'); try { @@ -679,6 +840,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONSYNCCOMPLETE_1100 + * @tc.name [JS-API8]DeviceKvStore.OnSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OnSyncComplete testcase 101 + */ it('testDeviceKvStoreOnSyncComplete101', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -703,6 +869,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONSYNCCOMPLETE_1200 + * @tc.name [JS-API8]DeviceKvStore.OnSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OnSyncComplete testcase 102 + */ it('testDeviceKvStoreOnSyncComplete102', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -723,11 +894,15 @@ describe('DeviceKvStoreCallbackTest', function () { }); }catch(e) { console.log('testDeviceKvStoreOnSyncComplete102 no peer device :e:' + e); - // expect(null).assertFail(); done(); } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONSYNCCOMPLETE_1300 + * @tc.name [JS-API8]DeviceKvStore.OnSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OnSyncComplete testcase 103 + */ it('testDeviceKvStoreOnSyncComplete103', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -748,11 +923,15 @@ describe('DeviceKvStoreCallbackTest', function () { }); }catch(e) { console.log('testDeviceKvStoreOnSyncComplete103 no peer device :e:' + e); - // expect(null).assertFail(); done(); } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_SETSYNCRANGE_1100 + * @tc.name [JS-API8]DeviceKvStore.SetSyncRange() + * @tc.desc Test Js Api DeviceKvStore.SetSyncRange testcase 101 + */ it('testDeviceKvStoreSetSyncRange101', 0, async function (done) { console.log('testDeviceKvStoreSetSyncRange101'); try { @@ -770,6 +949,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_SETSYNCRANGE_1200 + * @tc.name [JS-API8]DeviceKvStore.SetSyncRange() + * @tc.desc Test Js Api DeviceKvStore.SetSyncRange testcase 102 + */ it('testDeviceKvStoreSetSyncRange102', 0, async function (done) { console.log('testDeviceKvStoreSetSyncRange102'); try { @@ -787,6 +971,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_SETSYNCRANGE_1300 + * @tc.name [JS-API8]DeviceKvStore.SetSyncRange() + * @tc.desc Test Js Api DeviceKvStore.SetSyncRange testcase 103 + */ it('testDeviceKvStoreSetSyncRange103', 0, async function (done) { console.log('testDeviceKvStoreSetSyncRange103'); try { @@ -804,6 +993,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_1100 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 101 + */ it('testDeviceKvStorePutBatch101', 0, async function (done) { console.log('testDeviceKvStorePutBatch101'); try { @@ -839,6 +1033,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_1200 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 102 + */ it('testDeviceKvStorePutBatch102', 0, async function (done) { console.log('testDeviceKvStorePutBatch102'); try { @@ -874,6 +1073,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_1300 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 103 + */ it('testDeviceKvStorePutBatch103', 0, async function (done) { console.log('testDeviceKvStorePutBatch103'); try { @@ -909,6 +1113,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_1400 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 104 + */ it('testDeviceKvStorePutBatch104', 0, async function (done) { console.log('testDeviceKvStorePutBatch104'); try { @@ -944,6 +1153,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_1500 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 105 + */ it('testDeviceKvStorePutBatch105', 0, async function (done) { console.log('testDeviceKvStorePutBatch105'); try { @@ -980,6 +1194,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_1600 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 106 + */ it('testDeviceKvStorePutBatch106', 0, async function (done) { console.log('testDeviceKvStorePutBatch106'); try { @@ -1016,6 +1235,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBATCH_1100 + * @tc.name [JS-API8]DeviceKvStore.DeleteBatch() + * @tc.desc Test Js Api DeviceKvStore.DeleteBatch testcase 101 + */ it('testDeviceKvStoreDeleteBatch101', 0, async function (done) { console.log('testDeviceKvStoreDeleteBatch101'); try { @@ -1050,6 +1274,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBATCH_1200 + * @tc.name [JS-API8]DeviceKvStore.DeleteBatch() + * @tc.desc Test Js Api DeviceKvStore.DeleteBatch testcase 102 + */ it('testDeviceKvStoreDeleteBatch102', 0, async function (done) { console.log('testDeviceKvStoreDeleteBatch102'); try { @@ -1066,6 +1295,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBATCH_1300 + * @tc.name [JS-API8]DeviceKvStore.DeleteBatch() + * @tc.desc Test Js Api DeviceKvStore.DeleteBatch testcase 103 + */ it('testDeviceKvStoreDeleteBatch103', 0, async function (done) { console.log('testDeviceKvStoreDeleteBatch103'); try { @@ -1099,6 +1333,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_1100 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction testcase 101 + */ it('testDeviceKvStorestartTransaction101', 0, async function (done) { console.log('testDeviceKvStorestartTransaction101'); try { @@ -1107,7 +1346,6 @@ describe('DeviceKvStoreCallbackTest', function () { console.log('testDeviceKvStorestartTransaction101 0' + data) count++; }); - // startTransaction await kvStore.startTransaction(async function (err,data) { console.log('testDeviceKvStorestartTransaction101 startTransaction success'); expect(err == undefined).assertTrue(); @@ -1124,7 +1362,6 @@ describe('DeviceKvStoreCallbackTest', function () { console.log('testDeviceKvStorestartTransaction101 commit success'); expect(err == undefined).assertTrue(); await sleep(2000); - // assert expect(count == 1).assertTrue(); done(); }); @@ -1138,6 +1375,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_1200 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction testcase 102 + */ it('testDeviceKvStorestartTransaction102', 0, async function (done) { console.log('testDeviceKvStorestartTransaction102'); try { @@ -1158,7 +1400,6 @@ describe('DeviceKvStoreCallbackTest', function () { await kvStore.deleteBatch(keys, async function (err,data) { console.log('testDeviceKvStorestartTransaction102 deleteBatch success'); expect(err == undefined).assertTrue(); - // rollback await kvStore.rollback(async function (err,data) { console.log('testDeviceKvStorestartTransaction102 rollback success'); expect(err == undefined).assertTrue(); @@ -1176,6 +1417,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_1300 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction testcase 103 + */ it('testDeviceKvStorestartTransaction103', 0, async function (done) { console.log('testDeviceKvStorestartTransaction103'); try { @@ -1194,6 +1440,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_1400 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction testcase 104 + */ it('testDeviceKvStorestartTransaction104', 0, async function (done) { console.log('testDeviceKvStorestartTransaction104'); try { @@ -1212,6 +1463,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_1500 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction testcase 105 + */ it('testDeviceKvStorestartTransaction105', 0, async function (done) { console.log('testDeviceKvStorestartTransaction105'); try { @@ -1230,6 +1486,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_COMMIT_1100 + * @tc.name [JS-API8]DeviceKvStore.Commit() + * @tc.desc Test Js Api DeviceKvStore.Commit testcase 101 + */ it('testDeviceKvStoreCommit101', 0, async function (done) { console.log('testDeviceKvStoreCommit101'); try { @@ -1248,6 +1509,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_COMMIT_1200 + * @tc.name [JS-API8]DeviceKvStore.Commit() + * @tc.desc Test Js Api DeviceKvStore.Commit testcase 102 + */ it('testDeviceKvStoreCommit102', 0, async function (done) { console.log('testDeviceKvStoreCommit102'); try { @@ -1266,6 +1532,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_COMMIT_1300 + * @tc.name [JS-API8]DeviceKvStore.Commit() + * @tc.desc Test Js Api DeviceKvStore.Commit testcase 103 + */ it('testDeviceKvStoreCommit103', 0, async function (done) { console.log('testDeviceKvStoreCommit103'); try { @@ -1284,6 +1555,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ROLLBACK_1100 + * @tc.name [JS-API8]DeviceKvStore.Rollback() + * @tc.desc Test Js Api DeviceKvStore.Rollback testcase 101 + */ it('testDeviceKvStoreRollback101', 0, async function (done) { console.log('testDeviceKvStoreRollback101'); try { @@ -1302,6 +1578,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ROLLBACK_1200 + * @tc.name [JS-API8]DeviceKvStore.Rollback() + * @tc.desc Test Js Api DeviceKvStore.Rollback testcase 102 + */ it('testDeviceKvStoreRollback102', 0, async function (done) { console.log('testDeviceKvStoreRollback102'); try { @@ -1320,6 +1601,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ROLLBACK_1300 + * @tc.name [JS-API8]DeviceKvStore.Rollback() + * @tc.desc Test Js Api DeviceKvStore.Rollback testcase 103 + */ it('testDeviceKvStoreRollback103', 0, async function (done) { console.log('testDeviceKvStoreRollback103'); try { @@ -1338,6 +1624,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_1100 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync testcase 101 + */ it('testDeviceKvStoreEnableSync101', 0, async function (done) { console.log('testDeviceKvStoreEnableSync101'); try { @@ -1358,6 +1649,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_1200 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync testcase 102 + */ it('testDeviceKvStoreEnableSync102', 0, async function (done) { console.log('testDeviceKvStoreEnableSync102'); try { @@ -1378,6 +1674,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_1300 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync testcase 103 + */ it('testDeviceKvStoreEnableSync103', 0, async function (done) { console.log('testDeviceKvStoreEnableSync103'); try { @@ -1396,6 +1697,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_1400 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync testcase 104 + */ it('testDeviceKvStoreEnableSync104', 0, async function (done) { console.log('testDeviceKvStoreEnableSync104'); try { @@ -1414,6 +1720,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_1100 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData testcase 101 + */ it('testDeviceKvStoreRemoveDeviceData101', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData101'); try { @@ -1443,6 +1754,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_1200 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData testcase 102 + */ it('testDeviceKvStoreRemoveDeviceData102', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData102'); try { @@ -1461,6 +1777,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_1300 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData testcase 103 + */ it('testDeviceKvStoreRemoveDeviceData103', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData103'); try { @@ -1479,6 +1800,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_1400 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData testcase 104 + */ it('testDeviceKvStoreRemoveDeviceData104', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData104'); try { @@ -1497,6 +1823,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_1100 + * @tc.name [JS-API8]DeviceKvStore.GetResultSet() + * @tc.desc Test Js Api DeviceKvStore.GetResultSet() testcase 101 + */ it('testDeviceKvStoreGetResultSet101', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet101'); try { @@ -1534,6 +1865,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_1200 + * @tc.name [JS-API8]DeviceKvStore.GetResultSet() + * @tc.desc Test Js Api DeviceKvStore.GetResultSet() testcase 102 + */ it('testDeviceKvStoreGetResultSet102', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet102'); try { @@ -1555,6 +1891,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_1300 + * @tc.name [JS-API8]DeviceKvStore.GetResultSet() + * @tc.desc Test Js Api DeviceKvStore.GetResultSet() testcase 103 + */ it('testDeviceKvStoreGetResultSet103', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet103'); try { @@ -1571,6 +1912,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_1400 + * @tc.name [JS-API8]DeviceKvStore.GetResultSet() + * @tc.desc Test Js Api DeviceKvStore.GetResultSet() testcase 104 + */ it('testDeviceKvStoreGetResultSet104', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet104'); try { @@ -1587,6 +1933,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_1500 + * @tc.name [JS-API8]DeviceKvStore.GetResultSet() + * @tc.desc Test Js Api DeviceKvStore.GetResultSet() testcase 105 + */ it('testDeviceKvStoreGetResultSet105', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet105'); try { @@ -1626,6 +1977,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_1600 + * @tc.name [JS-API8]DeviceKvStore.GetResultSet() + * @tc.desc Test Js Api DeviceKvStore.GetResultSet() testcase 106 + */ it('testDeviceKvStoreGetResultSet106', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet106'); try { @@ -1666,6 +2022,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_1100 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet testcase 101 + */ it('testDeviceKvStoreCloseResultSet101', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet101'); try { @@ -1687,6 +2048,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_1200 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet testcase 102 + */ it('testDeviceKvStoreCloseResultSet102', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet102'); try { @@ -1712,6 +2078,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_1300 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet testcase 103 + */ it('testDeviceKvStoreCloseResultSet103', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet103'); try { @@ -1732,10 +2103,14 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_1400 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet testcase 104 + */ it('testDeviceKvStoreCloseResultSet104', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet104'); try { - // pass query console.log('testDeviceKvStoreCloseResultSet104 success'); }catch(e) { console.log('testDeviceKvStoreCloseResultSet104 e ' + e); @@ -1744,7 +2119,11 @@ describe('DeviceKvStoreCallbackTest', function () { done(); }) - + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSIZE_1100 + * @tc.name [JS-API8]DeviceKvStore.Get(ResultSize) + * @tc.desc Test Js Api DeviceKvStore.Get(ResultSize) testcase 101 + */ it('testDeviceKvStoreGetResultSize101', 0, async function (done) { console.log('testDeviceKvStoreGetResultSize101'); try { @@ -1779,6 +2158,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSIZE_1200 + * @tc.name [JS-API8]DeviceKvStore.Get(ResultSize) + * @tc.desc Test Js Api DeviceKvStore.Get(ResultSize) testcase 102 + */ it('testDeviceKvStoreGetResultSize102', 0, async function (done) { console.log('testDeviceKvStoreGetResultSize102'); try { @@ -1812,6 +2196,11 @@ describe('DeviceKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETENTRIES_1100 + * @tc.name [JS-API8]DeviceKvStore.GetEntries() + * @tc.desc Test Js Api DeviceKvStore.GetEntries() testcase 101 + */ it('testDeviceKvStoreGetEntries101', 0, async function (done) { console.log('testDeviceKvStoreGetEntries101'); try { @@ -1852,6 +2241,11 @@ describe('DeviceKvStoreCallbackTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETENTRIES_1200 + * @tc.name [JS-API8]DeviceKvStore.GetEntries() + * @tc.desc Test Js Api DeviceKvStore.GetEntries() testcase 102 + */ it('testDeviceKvStoreGetEntries102', 0, async function (done) { console.log('testDeviceKvStoreGetEntries102'); try { diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js index ca51faea2..29f13cdef 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -79,19 +79,35 @@ describe('DeviceKvStorePromiseTest', function () { }).catch((err) => { console.log('beforeAll createKVManager err ' + err); }); - // get localDeviceId - put, get deviceId on dataChange().. await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { kvStore = store; - console.log('beforeAll getKVStore success'); + console.log('beforeAll getKVStore for getDeviceId success'); }).catch((err) => { console.log('beforeAll getKVStore err ' + err); }); - kvStore.on('dataChange', 0, function (data) { - console.log('beforeAll on ' + JSON.stringify(data)); - localDeviceId = data.deviceId; - expect(localDeviceId != null).assertTrue(); + var getDeviceId = new Promise((resolve, reject) => { + kvStore.on('dataChange', 0, function (data) { + console.log('beforeAll on data change: ' + JSON.stringify(data)); + resolve(data.deviceId); + }); + kvStore.put("getDeviceId", "byPut").then((data) => { + console.log('beforeAll put success'); + expect(data == undefined).assertTrue(); + }); + setTimeout(() => { + reject(new Error('not resolved in 2 second, reject it.')) + }, 2000); + }); + await getDeviceId.then(function(deviceId) { + console.log('beforeAll getDeviceId ' + JSON.stringify(deviceId)); + localDeviceId = deviceId; + }).catch((error) => { + console.log('beforeAll can NOT getDeviceId, fail: ' + error); + expect(null).assertFail(); }); - await kvStore.put("getDeviceId", "byPut"); + await kvManager.closeKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID, kvStore); + await kvManager.deleteKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID); + kvStore = null; console.log('beforeAll end'); done(); }) @@ -131,6 +147,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTSTRING_0100 + * @tc.name [JS-API8]DeviceKvStore.Put(String) + * @tc.desc Test Js Api DeviceKvStore.Put(String) testcase 001 + */ it('testDeviceKvStorePutString001', 0, async function (done) { console.log('testDeviceKvStorePutString001'); try { @@ -147,6 +168,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTSTRING_0200 + * @tc.name [JS-API8]DeviceKvStore.Put(String) + * @tc.desc Test Js Api DeviceKvStore.Put(String) testcase 002 + */ it('testDeviceKvStorePutString002', 0, async function (done) { console.log('testDeviceKvStorePutString002'); try { @@ -164,6 +190,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTSTRING_0300 + * @tc.name [JS-API8]DeviceKvStore.Put(String) + * @tc.desc Test Js Api DeviceKvStore.Put(String) testcase 003 + */ it('testDeviceKvStorePutString003', 0, async function (done) { console.log('testDeviceKvStorePutString003'); try { @@ -181,6 +212,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTSTRING_0400 + * @tc.name [JS-API8]DeviceKvStore.Put(String) + * @tc.desc Test Js Api DeviceKvStore.Put(String) testcase 004 + */ it('testDeviceKvStorePutString004', 0, async function (done) { console.log('testDeviceKvStorePutString004'); try { @@ -209,6 +245,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETSTRING_0100 + * @tc.name [JS-API8]DeviceKvStore.Get(String) + * @tc.desc Test Js Api DeviceKvStore.Get(String) testcase 001 + */ it('testDeviceKvStoreGetString001', 0, async function (done) { console.log('testDeviceKvStoreGetString001'); try { @@ -233,6 +274,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETSTRING_0200 + * @tc.name [JS-API8]DeviceKvStore.Get(String) + * @tc.desc Test Js Api DeviceKvStore.Get(String) testcase 002 + */ it('testDeviceKvStoreGetString002', 0, async function (done) { console.log('testDeviceKvStoreGetString002'); try { @@ -248,6 +294,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_0100 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 001 + */ it('testDeviceKvStorePutInt001', 0, async function (done) { console.log('testDeviceKvStorePutInt001'); try { @@ -265,6 +316,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_0200 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 002 + */ it('testDeviceKvStorePutInt002', 0, async function (done) { console.log('testDeviceKvStorePutInt002'); try { @@ -290,6 +346,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_0300 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 003 + */ it('testDeviceKvStorePutInt003', 0, async function (done) { console.log('testDeviceKvStorePutInt003'); try { @@ -315,6 +376,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTINT_0400 + * @tc.name [JS-API8]DeviceKvStore.Put(Int) + * @tc.desc Test Js Api DeviceKvStore.Put(Int) testcase 004 + */ it('testDeviceKvStorePutInt004', 0, async function (done) { console.log('testDeviceKvStorePutInt004'); try { @@ -340,6 +406,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETINT_0100 + * @tc.name [JS-API8]DeviceKvStore.Get(Int) + * @tc.desc Test Js Api DeviceKvStore.Get(Int) testcase 001 + */ it('testDeviceKvStoreGetInt001', 0, async function (done) { console.log('testDeviceKvStoreGetInt001'); try { @@ -364,6 +435,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBOOL_0100 + * @tc.name [JS-API8]DeviceKvStore.Put(Bool) + * @tc.desc Test Js Api DeviceKvStore.Put(Bool) testcase 001 + */ it('testDeviceKvStorePutBool001', 0, async function (done) { console.log('testDeviceKvStorePutBool001'); try { @@ -381,6 +457,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETBOOL_0100 + * @tc.name [JS-API8]DeviceKvStore.Get(Bool) + * @tc.desc Test Js Api DeviceKvStore.Get(Bool) testcase 001 + */ it('testDeviceKvStoreGetBool001', 0, async function (done) { console.log('testDeviceKvStoreGetBool001'); try { @@ -406,6 +487,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTFLOAT_0100 + * @tc.name [JS-API8]DeviceKvStore.Put(Float) + * @tc.desc Test Js Api DeviceKvStore.Put(Float) testcase 001 + */ it('testDeviceKvStorePutFloat001', 0, async function (done) { console.log('testDeviceKvStorePutFloat001'); try { @@ -423,6 +509,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETFLOAT_0100 + * @tc.name [JS-API8]DeviceKvStore.Get(Float) + * @tc.desc Test Js Api DeviceKvStore.Get(Float) testcase 001 + */ it('testDeviceKvStoreGetFloat001', 0, async function (done) { console.log('testDeviceKvStoreGetFloat001'); try { @@ -448,6 +539,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETFLOAT_0200 + * @tc.name [JS-API8]DeviceKvStore.Get(Float) + * @tc.desc Test Js Api DeviceKvStore.Get(Float) testcase 002 + */ it('testDeviceKvStoreGetFloat002', 0, async function (done) { console.log('testDeviceKvStoreGetFloat002'); try { @@ -473,6 +569,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETFLOAT_0300 + * @tc.name [JS-API8]DeviceKvStore.Get(Float) + * @tc.desc Test Js Api DeviceKvStore.Get(Float) testcase 003 + */ it('testDeviceKvStoreGetFloat003', 0, async function (done) { console.log('testDeviceKvStoreGetFloat003'); try { @@ -498,6 +599,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETESTRING_0100 + * @tc.name [JS-API8]DeviceKvStore.DeleteString() + * @tc.desc Test Js Api DeviceKvStore.DeleteString() testcase 001 + */ it('testDeviceKvStoreDeleteString001', 0, async function (done) { console.log('testDeviceKvStoreDeleteString001'); try { @@ -523,6 +629,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETESTRING_0200 + * @tc.name [JS-API8]DeviceKvStore.DeleteString() + * @tc.desc Test Js Api DeviceKvStore.DeleteString() testcase 002 + */ it('testDeviceKvStoreDeleteString002', 0, async function (done) { console.log('testDeviceKvStoreDeleteString002'); try { @@ -551,6 +662,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETESTRING_0300 + * @tc.name [JS-API8]DeviceKvStore.DeleteString() + * @tc.desc Test Js Api DeviceKvStore.DeleteString() testcase 003 + */ it('testDeviceKvStoreDeleteString003', 0, async function (done) { console.log('testDeviceKvStoreDeleteString003'); try { @@ -568,6 +684,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEINT_0100 + * @tc.name [JS-API8]DeviceKvStore.DeleteInt() + * @tc.desc Test Js Api DeviceKvStore.DeleteInt() testcase 001 + */ it('testDeviceKvStoreDeleteInt001', 0, async function (done) { console.log('testDeviceKvStoreDeleteInt001'); try { @@ -592,6 +713,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEFLOAT_0100 + * @tc.name [JS-API8]DeviceKvStore.DeleteFloat() + * @tc.desc Test Js Api DeviceKvStore.DeleteFloat() testcase 001 + */ it('testDeviceKvStoreDeleteFloat001', 0, async function (done) { console.log('testDeviceKvStoreDeleteFloat001'); try { @@ -616,6 +742,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBOOL_0100 + * @tc.name [JS-API8]DeviceKvStore.DeleteBool() + * @tc.desc Test Js Api DeviceKvStore.DeleteBool() testcase 001 + */ it('testDeviceKvStoreDeleteBool001', 0, async function (done) { console.log('testDeviceKvStoreDeleteBool001'); try { @@ -640,6 +771,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONCHANGE_0100 + * @tc.name [JS-API8]DeviceKvStore.OnChange() + * @tc.desc Test Js Api DeviceKvStore.OnChange() testcase 001 + */ it('testDeviceKvStoreOnChange001', 0, async function (done) { try { kvStore.on('dataChange', 0, function (data) { @@ -660,6 +796,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONCHANGE_0200 + * @tc.name [JS-API8]DeviceKvStore.OnChange() + * @tc.desc Test Js Api DeviceKvStore.OnChange() testcase 002 + */ it('testDeviceKvStoreOnChange002', 0, async function (done) { try { kvStore.on('dataChange', 1, function (data) { @@ -680,6 +821,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONCHANGE_0300 + * @tc.name [JS-API8]DeviceKvStore.OnChange() + * @tc.desc Test Js Api DeviceKvStore.OnChange() testcase 003 + */ it('testDeviceKvStoreOnChange003', 0, async function (done) { try { kvStore.on('dataChange', 2, function (data) { @@ -700,6 +846,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONSYNCCOMPLETE_0100 + * @tc.name [JS-API8]DeviceKvStore.OnSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OnSyncComplete() testcase 001 + */ it('testDeviceKvStoreOnSyncComplete001', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -714,7 +865,6 @@ describe('DeviceKvStorePromiseTest', function () { kvStore.sync(devices, mode); }).catch((error) => { console.log('testDeviceKvStoreOnSyncComplete001 no peer device :e:' + error); - // expect(null).assertFail(); }); }catch(e) { console.log('testDeviceKvStoreOnSyncComplete001 put e ' + e); @@ -723,6 +873,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONSYNCCOMPLETE_0200 + * @tc.name [JS-API8]DeviceKvStore.OnSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OnSyncComplete() testcase 002 + */ it('testDeviceKvStoreOnSyncComplete002', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -737,7 +892,6 @@ describe('DeviceKvStorePromiseTest', function () { kvStore.sync(devices, mode); }).catch((error) => { console.log('testDeviceKvStoreOnSyncComplete002 no peer device :e:' + error); - // expect(null).assertFail(); }); }catch(e) { console.log('testDeviceKvStoreOnSyncComplete002 put e ' + e); @@ -746,6 +900,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ONSYNCCOMPLETE_0300 + * @tc.name [JS-API8]DeviceKvStore.OnSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OnSyncComplete() testcase 003 + */ it('testDeviceKvStoreOnSyncComplete003', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -760,7 +919,6 @@ describe('DeviceKvStorePromiseTest', function () { kvStore.sync(devices, mode); }).catch((error) => { console.log('testDeviceKvStoreOnSyncComplete003 no peer device :e:' + error); - // expect(null).assertFail(); }); }catch(e) { console.log('testDeviceKvStoreOnSyncComplete003 put e ' + e); @@ -769,6 +927,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFCHANGE_0100 + * @tc.name [JS-API8]DeviceKvStore.OffChange() + * @tc.desc Test Js Api DeviceKvStore.OffChange() testcase 001 + */ it('testDeviceKvStoreOffChange001', 0, async function (done) { console.log('testDeviceKvStoreOffChange001'); try { @@ -784,6 +947,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFCHANGE_0200 + * @tc.name [JS-API8]DeviceKvStore.OffChange() + * @tc.desc Test Js Api DeviceKvStore.OffChange() testcase 002 + */ it('testDeviceKvStoreOffChange002', 0, async function (done) { console.log('testDeviceKvStoreOffChange002'); try { @@ -803,6 +971,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFCHANGE_0300 + * @tc.name [JS-API8]DeviceKvStore.OffChange() + * @tc.desc Test Js Api DeviceKvStore.OffChange() testcase 003 + */ it('testDeviceKvStoreOffChange003', 0, async function (done) { console.log('testDeviceKvStoreOffChange003'); try { @@ -823,6 +996,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFCHANGE_0400 + * @tc.name [JS-API8]DeviceKvStore.OffChange() + * @tc.desc Test Js Api DeviceKvStore.OffChange() testcase 004 + */ it('testDeviceKvStoreOffChange004', 0, async function (done) { console.log('testDeviceKvStoreOffChange004'); try { @@ -838,6 +1016,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFSYNCCOMPLETE_0100 + * @tc.name [JS-API8]DeviceKvStore.OffSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OffSyncComplete() testcase 001 + */ it('testDeviceKvStoreOffSyncComplete001', 0, async function (done) { console.log('testDeviceKvStoreOffSyncComplete001'); try { @@ -853,6 +1036,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFSYNCCOMPLETE_0200 + * @tc.name [JS-API8]DeviceKvStore.OffSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OffSyncComplete() testcase 002 + */ it('testDeviceKvStoreOffSyncComplete002', 0, async function (done) { console.log('testDeviceKvStoreOffSyncComplete002'); try { @@ -873,6 +1061,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFSYNCCOMPLETE_0300 + * @tc.name [JS-API8]DeviceKvStore.OffSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OffSyncComplete() testcase 003 + */ it('testDeviceKvStoreOffSyncComplete003', 0, async function (done) { console.log('testDeviceKvStoreOffSyncComplete003'); try { @@ -894,6 +1087,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_OFFSYNCCOMPLETE_0400 + * @tc.name [JS-API8]DeviceKvStore.OffSyncComplete() + * @tc.desc Test Js Api DeviceKvStore.OffSyncComplete() testcase 004 + */ it('testDeviceKvStoreOffSyncComplete004', 0, async function (done) { console.log('testDeviceKvStoreOffSyncComplete004'); try { @@ -909,6 +1107,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_SETSYNCRANGE_0100 + * @tc.name [JS-API8]DeviceKvStore.SetSyncRange() + * @tc.desc Test Js Api DeviceKvStore.SetSyncRange() testcase 001 + */ it('testDeviceKvStoreSetSyncRange001', 0, async function (done) { console.log('testDeviceKvStoreSetSyncRange001'); try { @@ -928,6 +1131,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_SETSYNCRANGE_0200 + * @tc.name [JS-API8]DeviceKvStore.SetSyncRange() + * @tc.desc Test Js Api DeviceKvStore.SetSyncRange() testcase 002 + */ it('testDeviceKvStoreSetSyncRange002', 0, async function (done) { console.log('testDeviceKvStoreSetSyncRange002'); try { @@ -947,6 +1155,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_SETSYNCRANGE_0300 + * @tc.name [JS-API8]DeviceKvStore.SetSyncRange() + * @tc.desc Test Js Api DeviceKvStore.SetSyncRange() testcase 003 + */ it('testDeviceKvStoreSetSyncRange003', 0, async function (done) { console.log('testDeviceKvStoreSetSyncRange003'); try { @@ -966,6 +1179,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_0100 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 001 + */ it('testDeviceKvStorePutBatch001', 0, async function (done) { console.log('testDeviceKvStorePutBatch001'); try { @@ -997,6 +1215,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_0200 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 002 + */ it('testDeviceKvStorePutBatch002', 0, async function (done) { console.log('testDeviceKvStorePutBatch002'); try { @@ -1035,6 +1258,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_0300 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 003 + */ it('testDeviceKvStorePutBatch003', 0, async function (done) { console.log('testDeviceKvStorePutBatch003'); try { @@ -1073,6 +1301,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_0400 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 004 + */ it('testDeviceKvStorePutBatch004', 0, async function (done) { console.log('testDeviceKvStorePutBatch004'); try { @@ -1111,6 +1344,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_0500 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 005 + */ it('testDeviceKvStorePutBatch005', 0, async function (done) { console.log('testDeviceKvStorePutBatch005'); try { @@ -1150,6 +1388,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_PUTBATCH_0600 + * @tc.name [JS-API8]DeviceKvStore.Put(Batch) + * @tc.desc Test Js Api DeviceKvStore.Put(Batch) testcase 006 + */ it('testDeviceKvStorePutBatch006', 0, async function (done) { console.log('testDeviceKvStorePutBatch006'); try { @@ -1189,6 +1432,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBATCH_0100 + * @tc.name [JS-API8]DeviceKvStore.DeleteBatch() + * @tc.desc Test Js Api DeviceKvStore.DeleteBatch() testcase 001 + */ it('testDeviceKvStoreDeleteBatch001', 0, async function (done) { console.log('testDeviceKvStoreDeleteBatch001'); try { @@ -1228,6 +1476,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBATCH_0200 + * @tc.name [JS-API8]DeviceKvStore.DeleteBatch() + * @tc.desc Test Js Api DeviceKvStore.DeleteBatch() testcase 002 + */ it('testDeviceKvStoreDeleteBatch002', 0, async function (done) { console.log('testDeviceKvStoreDeleteBatch002'); try { @@ -1245,6 +1498,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_DELETEBATCH_0300 + * @tc.name [JS-API8]DeviceKvStore.DeleteBatch() + * @tc.desc Test Js Api DeviceKvStore.DeleteBatch() testcase 003 + */ it('testDeviceKvStoreDeleteBatch003', 0, async function (done) { console.log('testDeviceKvStoreDeleteBatch003'); try { @@ -1282,6 +1540,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_0100 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction() testcase 001 + */ it('testDeviceKvStorestartTransaction001', 0, async function (done) { console.log('testDeviceKvStorestartTransaction001'); try { @@ -1330,6 +1593,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_0200 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction() testcase 002 + */ it('testDeviceKvStorestartTransaction002', 0, async function (done) { console.log('testDeviceKvStorestartTransaction002'); try { @@ -1378,6 +1646,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_0300 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction() testcase 003 + */ it('testDeviceKvStorestartTransaction003', 0, async function (done) { console.log('testDeviceKvStorestartTransaction002'); try { @@ -1393,6 +1666,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_0400 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction() testcase 004 + */ it('testDeviceKvStorestartTransaction004', 0, async function (done) { console.log('testDeviceKvStorestartTransaction004'); try { @@ -1408,6 +1686,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_STARTTRANSACTION_0500 + * @tc.name [JS-API8]DeviceKvStore.startTransaction() + * @tc.desc Test Js Api DeviceKvStore.startTransaction() testcase 005 + */ it('testDeviceKvStorestartTransaction005', 0, async function (done) { console.log('testDeviceKvStorestartTransaction005'); try { @@ -1423,6 +1706,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_COMMIT_0100 + * @tc.name [JS-API8]DeviceKvStore.Commit() + * @tc.desc Test Js Api DeviceKvStore.Commit() testcase 001 + */ it('testDeviceKvStoreCommit001', 0, async function (done) { console.log('testDeviceKvStoreCommit001'); try { @@ -1438,6 +1726,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_COMMIT_0200 + * @tc.name [JS-API8]DeviceKvStore.Commit() + * @tc.desc Test Js Api DeviceKvStore.Commit() testcase 002 + */ it('testDeviceKvStoreCommit002', 0, async function (done) { console.log('testDeviceKvStoreCommit002'); try { @@ -1453,6 +1746,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_COMMIT_0300 + * @tc.name [JS-API8]DeviceKvStore.Commit() + * @tc.desc Test Js Api DeviceKvStore.Commit() testcase 003 + */ it('testDeviceKvStoreCommit003', 0, async function (done) { console.log('testDeviceKvStoreCommit003'); try { @@ -1468,6 +1766,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ROLLBACK_0100 + * @tc.name [JS-API8]DeviceKvStore.Rollback() + * @tc.desc Test Js Api DeviceKvStore.Rollback() testcase 001 + */ it('testDeviceKvStoreRollback001', 0, async function (done) { console.log('testDeviceKvStoreRollback001'); try { @@ -1483,6 +1786,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ROLLBACK_0200 + * @tc.name [JS-API8]DeviceKvStore.Rollback() + * @tc.desc Test Js Api DeviceKvStore.Rollback() testcase 002 + */ it('testDeviceKvStoreRollback002', 0, async function (done) { console.log('testDeviceKvStoreRollback002'); try { @@ -1498,6 +1806,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ROLLBACK_0300 + * @tc.name [JS-API8]DeviceKvStore.Rollback() + * @tc.desc Test Js Api DeviceKvStore.Rollback() testcase 003 + */ it('testDeviceKvStoreRollback003', 0, async function (done) { console.log('testDeviceKvStoreRollback003'); try { @@ -1513,6 +1826,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_0100 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync() testcase 001 + */ it('testDeviceKvStoreEnableSync001', 0, async function (done) { console.log('testDeviceKvStoreEnableSync001'); try { @@ -1523,7 +1841,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreEnableSync001 enableSync fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreEnableSync001 e ' + e); expect(null).assertFail(); @@ -1531,6 +1848,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_0200 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync() testcase 002 + */ it('testDeviceKvStoreEnableSync002', 0, async function (done) { console.log('testDeviceKvStoreEnableSync002'); try { @@ -1541,7 +1863,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreEnableSync002 enableSync fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreEnableSync002 e ' + e); expect(null).assertFail(); @@ -1549,6 +1870,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_0300 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync() testcase 003 + */ it('testDeviceKvStoreEnableSync003', 0, async function (done) { console.log('testDeviceKvStoreEnableSync003'); try { @@ -1564,6 +1890,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_ENABLESYNC_0400 + * @tc.name [JS-API8]DeviceKvStore.EnableSync() + * @tc.desc Test Js Api DeviceKvStore.EnableSync() testcase 004 + */ it('testDeviceKvStoreEnableSync004', 0, async function (done) { console.log('testDeviceKvStoreEnableSync004'); try { @@ -1573,13 +1904,17 @@ describe('DeviceKvStorePromiseTest', function () { }).catch((err) => { console.log('testDeviceKvStoreEnableSync004 enableSync fail ' + err); }); - }catch(e) { console.log('testDeviceKvStoreEnableSync004 e ' + e); } done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_0100 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData() testcase 001 + */ it('testDeviceKvStoreRemoveDeviceData001', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData001'); try { @@ -1590,7 +1925,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreRemoveDeviceData001 put fail ' + err); expect(null).assertFail(); }); - var deviceid = 'no_exist_device_id'; await kvStore.removeDeviceData(deviceid).then((err) => { console.log('testDeviceKvStoreRemoveDeviceData001 removeDeviceData success'); @@ -1598,7 +1932,6 @@ describe('DeviceKvStorePromiseTest', function () { }).catch((err) => { console.log('testDeviceKvStoreRemoveDeviceData001 removeDeviceData fail ' + err); }); - await kvStore.get(localDeviceId, KEY_TEST_STRING_ELEMENT).then((data) => { console.log('testDeviceKvStoreRemoveDeviceData001 get success data:' + data); expect(data == VALUE_TEST_STRING_ELEMENT).assertTrue(); @@ -1606,7 +1939,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreRemoveDeviceData001 get fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreRemoveDeviceData001 e ' + e); expect(null).assertFail(); @@ -1614,6 +1946,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_0200 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData() testcase 002 + */ it('testDeviceKvStoreRemoveDeviceData002', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData002'); try { @@ -1629,6 +1966,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_0300 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData() testcase 003 + */ it('testDeviceKvStoreRemoveDeviceData003', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData003'); try { @@ -1644,6 +1986,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_REMOVEDEVICEDATA_0400 + * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() + * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData() testcase 004 + */ it('testDeviceKvStoreRemoveDeviceData004', 0, async function (done) { console.log('testDeviceKvStoreRemoveDeviceData004'); try { @@ -1659,6 +2006,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_0100 + * @tc.name [JS-API8]DeviceKvStore.getResultSet() + * @tc.desc Test Js Api DeviceKvStore.getResultSet() testcase 001 + */ it('testDeviceKvStoreGetResultSet001', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet001'); try { @@ -1697,7 +2049,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreGetResultSet001 closeResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreGetResultSet001 e ' + e); expect(null).assertFail(); @@ -1705,6 +2056,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_0200 + * @tc.name [JS-API8]DeviceKvStore.getResultSet() + * @tc.desc Test Js Api DeviceKvStore.getResultSet() testcase 002 + */ it('testDeviceKvStoreGetResultSet002', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet002'); try { @@ -1731,6 +2087,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_0300 + * @tc.name [JS-API8]DeviceKvStore.getResultSet() + * @tc.desc Test Js Api DeviceKvStore.getResultSet() testcase 003 + */ it('testDeviceKvStoreGetResultSet003', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet003'); try { @@ -1740,7 +2101,6 @@ describe('DeviceKvStorePromiseTest', function () { expect(null).assertFail(); }).catch((err) => { console.log('testDeviceKvStoreGetResultSet003 getResultSet fail ' + err); - }); }catch(e) { console.log('testDeviceKvStoreGetResultSet003 e ' + e); @@ -1749,6 +2109,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_0400 + * @tc.name [JS-API8]DeviceKvStore.getResultSet() + * @tc.desc Test Js Api DeviceKvStore.getResultSet() testcase 004 + */ it('testDeviceKvStoreGetResultSet004', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet004'); try { @@ -1758,7 +2123,6 @@ describe('DeviceKvStorePromiseTest', function () { expect(null).assertFail(); }).catch((err) => { console.log('testDeviceKvStoreGetResultSet004 getResultSet fail ' + err); - }); }catch(e) { console.log('testDeviceKvStoreGetResultSet004 e ' + e); @@ -1767,6 +2131,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_0500 + * @tc.name [JS-API8]DeviceKvStore.getResultSet() + * @tc.desc Test Js Api DeviceKvStore.getResultSet() testcase 005 + */ it('testDeviceKvStoreGetResultSet005', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet005'); try { @@ -1809,7 +2178,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreGetResultSet005 closeResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreGetResultSet005 e ' + e); expect(null).assertFail(); @@ -1817,6 +2185,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSET_0600 + * @tc.name [JS-API8]DeviceKvStore.getResultSet() + * @tc.desc Test Js Api DeviceKvStore.getResultSet() testcase 006 + */ it('testDeviceKvStoreGetResultSet006', 0, async function (done) { console.log('testDeviceKvStoreGetResultSet006'); try { @@ -1859,7 +2232,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreGetResultSet006 closeResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreGetResultSet006 e ' + e); expect(null).assertFail(); @@ -1867,6 +2239,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_0100 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet() testcase 001 + */ it('testDeviceKvStoreCloseResultSet001', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet001'); try { @@ -1885,6 +2262,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_0200 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet() testcase 002 + */ it('testDeviceKvStoreCloseResultSet002', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet002'); try { @@ -1911,6 +2293,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_0300 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet() testcase 003 + */ it('testDeviceKvStoreCloseResultSet003', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet003'); try { @@ -1929,10 +2316,14 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_CLOSERESULTSET_0400 + * @tc.name [JS-API8]DeviceKvStore.CloseResultSet() + * @tc.desc Test Js Api DeviceKvStore.CloseResultSet() testcase 004 + */ it('testDeviceKvStoreCloseResultSet004', 0, async function (done) { console.log('testDeviceKvStoreCloseResultSet004'); try { - // pass query console.log('testDeviceKvStoreCloseResultSet004 success'); }catch(e) { console.log('testDeviceKvStoreCloseResultSet004 e ' + e); @@ -1941,7 +2332,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) - + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSIZE_0100 + * @tc.name [JS-API8]DeviceKvStore.Get(ResultSize) + * @tc.desc Test Js Api DeviceKvStore.Get(ResultSize) testcase 001 + */ it('testDeviceKvStoreGetResultSize001', 0, async function (done) { console.log('testDeviceKvStoreGetResultSize001'); try { @@ -1974,7 +2369,6 @@ describe('DeviceKvStorePromiseTest', function () { console.log('testDeviceKvStoreGetResultSize001 getResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testDeviceKvStoreGetResultSize001 e ' + e); expect(null).assertFail(); @@ -1982,6 +2376,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETRESULTSIZE_0200 + * @tc.name [JS-API8]DeviceKvStore.Get(ResultSize) + * @tc.desc Test Js Api DeviceKvStore.Get(ResultSize) testcase 002 + */ it('testDeviceKvStoreGetResultSize002', 0, async function (done) { console.log('testDeviceKvStoreGetResultSize001'); try { @@ -2020,6 +2419,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETENTRIES_0100 + * @tc.name [JS-API8]DeviceKvStore.GetEntries() + * @tc.desc Test Js Api DeviceKvStore.GetEntries() testcase 001 + */ it('testDeviceKvStoreGetEntries001', 0, async function (done) { console.log('testDeviceKvStoreGetEntries001'); try { @@ -2063,6 +2467,11 @@ describe('DeviceKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_DEVICEKVSTORE_GETENTRIES_0200 + * @tc.name [JS-API8]DeviceKvStore.GetEntries() + * @tc.desc Test Js Api DeviceKvStore.GetEntries() testcase 002 + */ it('testDeviceKvStoreGetEntries002', 0, async function (done) { console.log('testDeviceKvStoreGetEntries002'); try { diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/FieldNodeJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/FieldNodeJsunit.test.js index b5f5c7d2c..2135bdc9b 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/FieldNodeJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/FieldNodeJsunit.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,7 +20,11 @@ function sleep(ms) { } describe('FieldNodeTest', function() { - // appendChild(child: FieldNode): boolean + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_FIELDNODE_APPENDCHILD_0100 + * @tc.name [JS-API8]FieldNode.AppendChild(). + * @tc.desc Test Js Api FieldNode.AppendChild() testcase 001 + */ it('testAppendChild001', 0, async function(done) { try { let node = new ddm.FieldNode("root"); @@ -42,6 +46,11 @@ describe('FieldNodeTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_FIELDNODE_APPENDCHILD_0200 + * @tc.name [JS-API8]FieldNode.AppendChild(). + * @tc.desc Test Js Api FieldNode.AppendChild() testcase 002 + */ it('testAppendChild002', 0, async function(done) { try { let node = new ddm.FieldNode("root"); @@ -56,6 +65,11 @@ describe('FieldNodeTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_FIELDNODE_APPENDCHILD_0300 + * @tc.name [JS-API8]FieldNode.AppendChild(). + * @tc.desc Test Js Api FieldNode.AppendChild() testcase 003 + */ it('testAppendChild003', 0, async function(done) { try { let node = new ddm.FieldNode("root"); @@ -69,7 +83,11 @@ describe('FieldNodeTest', function() { done(); }) - // toJson(): string + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_FIELDNODE_TOJSON_0100 + * @tc.name [JS-API8]FieldNode.ToJson(). + * @tc.desc Test Js Api FieldNode.ToJson() testcase 001 + */ it('testToJson001', 0, async function(done) { try { let node = new ddm.FieldNode("root"); @@ -82,6 +100,11 @@ describe('FieldNodeTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_FIELDNODE_TOJSON_0200 + * @tc.name [JS-API8]FieldNode.ToJson(). + * @tc.desc Test Js Api FieldNode.ToJson() testcase 002 + */ it('testToJson002', 0, async function(done) { try { let node = new ddm.FieldNode("root"); @@ -94,6 +117,11 @@ describe('FieldNodeTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_FIELDNODE_TOJSON_0300 + * @tc.name [JS-API8]FieldNode.ToJson(). + * @tc.desc Test Js Api FieldNode.ToJson() testcase 003 + */ it('testToJson003', 0, async function(done) { try { let node = new ddm.FieldNode(); diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js index 41644620d..ea103bfee 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -69,6 +69,11 @@ describe('KVManagerCallbackTest', function () { }); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1100 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 101 + */ it('testKVManagerGetKVStore101', 0, async function (done) { console.log('testKVManagerGetKVStore101'); try { @@ -84,6 +89,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1200 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 102 + */ it('testKVManagerGetKVStore102', 0, async function (done) { console.log('testKVManagerGetKVStore102'); try { @@ -102,6 +112,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1300 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 103 + */ it('testKVManagerGetKVStore103', 0, async function (done) { console.log('testKVManagerGetKVStore103'); const optionsInfo = { @@ -128,10 +143,15 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1400 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 104 + */ it('testKVManagerGetKVStore104', 0, async function (done) { console.log('testKVManagerGetKVStore104'); const optionsInfo = { - createIfMissing : false, // when false getkvstore error + createIfMissing : false, encrypt : false, backup : false, autoSync : true, @@ -155,6 +175,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1500 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 105 + */ it('testKVManagerGetKVStore105', 0, async function (done) { console.log('testKVManagerGetKVStore105'); const optionsInfo = { @@ -180,6 +205,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1600 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 106 + */ it('testKVManagerGetKVStore106', 0, async function (done) { console.log('testKVManagerGetKVStore106'); const optionsInfo = { @@ -205,6 +235,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1700 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 107 + */ it('testKVManagerGetKVStore107', 0, async function (done) { console.log('testKVManagerGetKVStore107'); const optionsInfo = { @@ -230,6 +265,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1800 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 108 + */ it('testKVManagerGetKVStore108', 0, async function (done) { console.log('testKVManagerGetKVStore108'); const optionsInfo = { @@ -255,6 +295,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1900 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 109 + */ it('testKVManagerGetKVStore109', 0, async function (done) { console.log('testKVManagerGetKVStore109'); const optionsInfo = { @@ -280,6 +325,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1100 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 110 + */ it('testKVManagerGetKVStore110', 0, async function (done) { console.log('testKVManagerGetKVStore110'); const optionsInfo = { @@ -305,6 +355,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1110 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 111 + */ it('testKVManagerGetKVStore111', 0, async function (done) { console.log('testKVManagerGetKVStore111'); const optionsInfo = { @@ -330,6 +385,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1120 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 112 + */ it('testKVManagerGetKVStore112', 0, async function (done) { console.log('testKVManagerGetKVStore112'); const optionsInfo = { @@ -355,6 +415,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1130 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 113 + */ it('testKVManagerGetKVStore113', 0, async function (done) { console.log('testKVManagerGetKVStore113'); const optionsInfo = { @@ -382,6 +447,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1140 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 114 + */ it('testKVManagerGetKVStore114', 0, async function (done) { console.log('testKVManagerGetKVStore114'); const optionsInfo = { @@ -407,6 +477,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1150 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 115 + */ it('testKVManagerGetKVStore115', 0, async function (done) { console.log('testKVManagerGetKVStore115'); const optionsInfo = { @@ -432,6 +507,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1160 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 116 + */ it('testKVManagerGetKVStore116', 0, async function (done) { console.log('testKVManagerGetKVStore116'); const optionsInfo = { @@ -457,6 +537,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1170 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 117 + */ it('testKVManagerGetKVStore117', 0, async function (done) { console.log('testKVManagerGetKVStore117'); const optionsInfo = { @@ -482,6 +567,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1180 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 118 + */ it('testKVManagerGetKVStore118', 0, async function (done) { console.log('testKVManagerGetKVStore118'); const optionsInfo = { @@ -507,6 +597,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1190 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 119 + */ it('testKVManagerGetKVStore119', 0, async function (done) { console.log('testKVManagerGetKVStore119'); const optionsInfo = { @@ -532,6 +627,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_1100 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 101 + */ it('testKVManagerCloseKVStore101', 0, async function (done) { console.log('testKVManagerCloseKVStore101'); try { @@ -551,6 +651,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_1200 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 102 + */ it('testKVManagerCloseKVStore102', 0, async function (done) { console.log('testKVManagerCloseKVStore102'); try { @@ -579,6 +684,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_1300 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 103 + */ it('testKVManagerCloseKVStore103', 0, async function (done) { console.log('testKVManagerCloseKVStore103'); try { @@ -607,6 +717,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_1400 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 104 + */ it('testKVManagerCloseKVStore104', 0, async function (done) { console.log('testKVManagerCloseKVStore104'); try { @@ -622,6 +737,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_1100 + * @tc.name [JS-API8]KVManager.DeleteKVStore. + * @tc.desc Test Js Api KVManager.DeleteKVStore testcase 101 + */ it('testKVManagerDeleteKVStore101', 0, async function (done) { console.log('testKVManagerDeleteKVStore101'); try { @@ -641,6 +761,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_1200 + * @tc.name [JS-API8]KVManager.DeleteKVStore. + * @tc.desc Test Js Api KVManager.DeleteKVStore testcase 102 + */ it('testKVManagerDeleteKVStore102', 0, async function (done) { console.log('testKVManagerDeleteKVStore102'); try { @@ -669,6 +794,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_1300 + * @tc.name [JS-API8]KVManager.DeleteKVStore. + * @tc.desc Test Js Api KVManager.DeleteKVStore testcase 103 + */ it('testKVManagerDeleteKVStore103', 0, async function (done) { console.log('testKVManagerDeleteKVStore103'); try { @@ -687,6 +817,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETALLKVSTOREID_1100 + * @tc.name [JS-API8]KVManager.GetAllKVStoreId. + * @tc.desc Test Js Api KVManager.GetAllKVStoreId testcase 101 + */ it('testKVManagerGetAllKVStoreId101', 0, async function (done) { console.log('testKVManagerGetAllKVStoreId101'); try { @@ -703,6 +838,11 @@ describe('KVManagerCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETALLKVSTOREID_1200 + * @tc.name [JS-API8]KVManager.GetAllKVStoreId. + * @tc.desc Test Js Api KVManager.GetAllKVStoreId testcase 102 + */ it('testKVManagerGetAllKVStoreId102', 0, async function (done) { console.log('testKVManagerGetAllKVStoreId102'); try { diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js index 853742c7c..3b78a8e35 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -76,6 +76,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1000 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 001 + */ it('testKVManagerGetKVStore001', 0, async function (done) { console.log('testKVManagerGetKVStore001'); try { @@ -91,6 +96,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_2000 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 002 + */ it('testKVManagerGetKVStore002', 0, async function (done) { console.log('testKVManagerGetKVStore002'); try { @@ -106,6 +116,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0300 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 003 + */ it('testKVManagerGetKVStore003', 0, async function (done) { console.log('testKVManagerGetKVStore003'); const optionsInfo = { @@ -128,10 +143,15 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0400 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 004 + */ it('testKVManagerGetKVStore004', 0, async function (done) { console.log('testKVManagerGetKVStore004'); const optionsInfo = { - createIfMissing : false, // when false getkvstore error + createIfMissing : false, encrypt : false, backup : false, autoSync : true, @@ -148,6 +168,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0500 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 005 + */ it('testKVManagerGetKVStore005', 0, async function (done) { console.log('testKVManagerGetKVStore005'); const optionsInfo = { @@ -170,6 +195,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0600 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 006 + */ it('testKVManagerGetKVStore006', 0, async function (done) { console.log('testKVManagerGetKVStore006'); const optionsInfo = { @@ -192,6 +222,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0700 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 007 + */ it('testKVManagerGetKVStore007', 0, async function (done) { console.log('testKVManagerGetKVStore006'); const optionsInfo = { @@ -214,6 +249,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0800 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 008 + */ it('testKVManagerGetKVStore008', 0, async function (done) { console.log('testKVManagerGetKVStore008'); const optionsInfo = { @@ -236,6 +276,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_0900 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 009 + */ it('testKVManagerGetKVStore009', 0, async function (done) { console.log('testKVManagerGetKVStore009'); const optionsInfo = { @@ -258,6 +303,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1000 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 010 + */ it('testKVManagerGetKVStore010', 0, async function (done) { console.log('testKVManagerGetKVStore010'); const optionsInfo = { @@ -280,6 +330,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1100 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 011 + */ it('testKVManagerGetKVStore011', 0, async function (done) { console.log('testKVManagerGetKVStore011'); const optionsInfo = { @@ -302,6 +357,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1200 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 012 + */ it('testKVManagerGetKVStore012', 0, async function (done) { console.log('testKVManagerGetKVStore012'); const optionsInfo = { @@ -324,6 +384,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1300 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 013 + */ it('testKVManagerGetKVStore013', 0, async function (done) { console.log('testKVManagerGetKVStore013'); const optionsInfo = { @@ -331,7 +396,7 @@ describe('KVManagerPromiseTest', function () { encrypt : false, backup : false, autoSync : true, - kvStoreType : factory.KVStoreType.MULTI_VERSION, // unsupport MULTI_VERSION + kvStoreType : factory.KVStoreType.MULTI_VERSION, schema : '', securityLevel : factory.SecurityLevel.S2, } @@ -348,6 +413,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1400 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 014 + */ it('testKVManagerGetKVStore014', 0, async function (done) { console.log('testKVManagerGetKVStore014'); const optionsInfo = { @@ -370,6 +440,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1500 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 015 + */ it('testKVManagerGetKVStore015', 0, async function (done) { console.log('testKVManagerGetKVStore015'); const optionsInfo = { @@ -392,6 +467,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1600 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 016 + */ it('testKVManagerGetKVStore016', 0, async function (done) { console.log('testKVManagerGetKVStore016'); const optionsInfo = { @@ -414,6 +494,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1700 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 017 + */ it('testKVManagerGetKVStore017', 0, async function (done) { console.log('testKVManagerGetKVStore017'); const optionsInfo = { @@ -436,6 +521,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1800 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 018 + */ it('testKVManagerGetKVStore018', 0, async function (done) { console.log('testKVManagerGetKVStore018'); const optionsInfo = { @@ -458,6 +548,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1900 + * @tc.name [JS-API8]KVManager.GetKVStore. + * @tc.desc Test Js Api KVManager.GetKVStore testcase 019 + */ it('testKVManagerGetKVStore019', 0, async function (done) { console.log('testKVManagerGetKVStore019'); const optionsInfo = { @@ -480,6 +575,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0100 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 001 + */ it('testKVManagerCloseKVStore001', 0, async function (done) { console.log('testKVManagerCloseKVStore001'); await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { @@ -498,6 +598,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0200 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 002 + */ it('testKVManagerCloseKVStore002', 0, async function (done) { console.log('testKVManagerCloseKVStore002'); await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { @@ -520,6 +625,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0300 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 003 + */ it('testKVManagerCloseKVStore003', 0, async function (done) { console.log('testKVManagerCloseKVStore003'); await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { @@ -542,6 +652,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0400 + * @tc.name [JS-API8]KVManager.CloseKVStore. + * @tc.desc Test Js Api KVManager.CloseKVStore testcase 004 + */ it('testKVManagerCloseKVStore004', 0, async function (done) { console.log('testKVManagerCloseKVStore004'); await kvManager.closeKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID, kvStore).then(() => { @@ -553,6 +668,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_0100 + * @tc.name [JS-API8]KVManager.DeleteKVStore. + * @tc.desc Test Js Api KVManager.DeleteKVStore testcase 001 + */ it('testKVManagerDeleteKVStore001', 0, async function (done) { console.log('testKVManagerDeleteKVStore001'); await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { @@ -571,6 +691,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_0200 + * @tc.name [JS-API8]KVManager.DeleteKVStore. + * @tc.desc Test Js Api KVManager.DeleteKVStore testcase 002 + */ it('testKVManagerDeleteKVStore002', 0, async function (done) { console.log('testKVManagerDeleteKVStore002'); await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { @@ -593,6 +718,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_0300 + * @tc.name [JS-API8]KVManager.DeleteKVStore. + * @tc.desc Test Js Api KVManager.DeleteKVStore testcase 003 + */ it('testKVManagerDeleteKVStore003', 0, async function (done) { console.log('testKVManagerDeleteKVStore003'); await kvManager.deleteKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID).then(() => { @@ -604,6 +734,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETALLKVSTOREID_0100 + * @tc.name [JS-API8]KVManager.GetAllKVStoreId. + * @tc.desc Test Js Api KVManager.GetAllKVStoreId testcase 001 + */ it('testKVManagerGetAllKVStoreId001', 0, async function (done) { console.log('testKVManagerGetAllKVStoreId001'); await kvManager.getAllKVStoreId(TEST_BUNDLE_NAME).then((data) => { @@ -617,6 +752,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETALLKVSTOREID_0200 + * @tc.name [JS-API8]KVManager.GetAllKVStoreId. + * @tc.desc Test Js Api KVManager.GetAllKVStoreId testcase 002 + */ it('testKVManagerGetAllKVStoreId002', 0, async function (done) { console.log('testKVManagerGetAllKVStoreId002'); await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { @@ -639,6 +779,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_ON_0100 + * @tc.name [JS-API8]KVManager.On. + * @tc.desc Test Js Api KVManager.On testcase 001 + */ it('testKVManagerOn001', 0, function (done) { console.log('testKVManagerOn001'); var deathCallback = function () { @@ -649,6 +794,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_ON_0200 + * @tc.name [JS-API8]KVManager.On. + * @tc.desc Test Js Api KVManager.On testcase 002 + */ it('testKVManagerOn002', 0, function (done) { console.log('testKVManagerOn002'); var deathCallback1 = function () { @@ -664,6 +814,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_ON_0300 + * @tc.name [JS-API8]KVManager.On. + * @tc.desc Test Js Api KVManager.On testcase 003 + */ it('testKVManagerOn003', 0, function (done) { console.log('testKVManagerOn003'); var deathCallback = function () { @@ -675,6 +830,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_OFF_0100 + * @tc.name [JS-API8]KVManager.Off. + * @tc.desc Test Js Api KVManager.Off testcase 001 + */ it('testKVManagerOff001', 0, function (done) { console.log('testKVManagerOff001'); var deathCallback = function () { @@ -684,6 +844,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_OFF_0200 + * @tc.name [JS-API8]KVManager.Off. + * @tc.desc Test Js Api KVManager.Off testcase 002 + */ it('testKVManagerOff002', 0, function (done) { console.log('testKVManagerOff002'); var deathCallback = function () { @@ -694,6 +859,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_OFF_0300 + * @tc.name [JS-API8]KVManager.Off. + * @tc.desc Test Js Api KVManager.Off testcase 003 + */ it('testKVManagerOff003', 0, function (done) { console.log('testKVManagerOff003'); var deathCallback1 = function () { @@ -708,6 +878,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_OFF_0400 + * @tc.name [JS-API8]KVManager.Off. + * @tc.desc Test Js Api KVManager.Off testcase 004 + */ it('testKVManagerOff004', 0, function (done) { console.log('testKVManagerOff004'); var deathCallback = function () { @@ -719,6 +894,11 @@ describe('KVManagerPromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_OFF_0500 + * @tc.name [JS-API8]KVManager.Off. + * @tc.desc Test Js Api KVManager.Off testcase 005 + */ it('testKVManagerOff005', 0, function (done) { console.log('testKVManagerOff001'); var deathCallback = function () { diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvStoreResultSetJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvStoreResultSetJsunit.test.js index 3c4636ac4..b7b863c25 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvStoreResultSetJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvStoreResultSetJsunit.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -130,7 +130,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // getCount(): number; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0100 + * @tc.name [JS-API8]KvStoreResultSet.GetCount() + * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 001 + */ it('testKvStoreResultSetGetCount001', 0, async function(done) { try { var count = resultSet.getCount(); @@ -143,6 +147,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0200 + * @tc.name [JS-API8]KvStoreResultSet.GetCount() + * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 002 + */ it('testKvStoreResultSetGetCount002', 0, async function(done) { try { var rs; @@ -167,6 +176,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0300 + * @tc.name [JS-API8]KvStoreResultSet.GetCount() + * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 003 + */ it('testKvStoreResultSetGetCount003', 0, async function(done) { try { var count = resultSet.getCount(123); @@ -178,6 +192,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0400 + * @tc.name [JS-API8]KvStoreResultSet.GetCount() + * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 004 + */ it('testKvStoreResultSetGetCount004', 0, async function(done) { try { var count = resultSet.getCount(123, 'test_string'); @@ -189,7 +208,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // getPosition(): number; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0100 + * @tc.name [JS-API8]KvStoreResultSet.GetPosition() + * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 001 + */ it('testKvStoreResultSetGetPosition001', 0, async function(done) { try { var positon = resultSet.getPosition(); @@ -202,6 +225,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0200 + * @tc.name [JS-API8]KvStoreResultSet.GetPosition() + * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 002 + */ it('testKvStoreResultSetGetPosition002', 0, async function(done) { try { var positon = resultSet.getPosition(); @@ -218,6 +246,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0300 + * @tc.name [JS-API8]KvStoreResultSet.GetPosition() + * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 003 + */ it('testKvStoreResultSetGetPosition003', 0, async function(done) { try { var positon = resultSet.getPosition(123); @@ -229,6 +262,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0400 + * @tc.name [JS-API8]KvStoreResultSet.GetPosition() + * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 004 + */ it('testKvStoreResultSetGetPosition004', 0, async function(done) { try { var positon = resultSet.getPosition(123, 'test_string'); @@ -240,7 +278,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // moveToFirst(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0100 + * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst() + * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 001 + */ it('testKvStoreResultSetMoveToFirst001', 0, async function(done) { try { var moved = resultSet.moveToFirst(); @@ -253,6 +295,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0200 + * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst() + * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 002 + */ it('testKvStoreResultSetMoveToFirst002', 0, async function(done) { try { var moved = resultSet.moveToFirst(); @@ -268,6 +315,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0300 + * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst() + * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 003 + */ it('testKvStoreResultSetMoveToFirst003', 0, async function(done) { try { var moved = resultSet.moveToFirst(123); @@ -279,6 +331,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0400 + * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst() + * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 004 + */ it('testKvStoreResultSetMoveToFirst004', 0, async function(done) { try { var moved = resultSet.moveToFirst(123, 'test_string'); @@ -290,6 +347,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0500 + * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst() + * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 005 + */ it('testKvStoreResultSetMoveToFirst005', 0, async function(done) { try { var moved = resultSet.moveToLast(); @@ -303,7 +365,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // moveToLast(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0100 + * @tc.name [JS-API8]KvStoreResultSet.MoveToLast() + * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 001 + */ it('testKvStoreResultSetMoveToLast001', 0, async function(done) { try { var moved = resultSet.moveToLast(); @@ -316,6 +382,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0200 + * @tc.name [JS-API8]KvStoreResultSet.MoveToLast() + * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 002 + */ it('testKvStoreResultSetMoveToLast002', 0, async function(done) { try { var moved = resultSet.moveToLast(); @@ -328,6 +399,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0300 + * @tc.name [JS-API8]KvStoreResultSet.MoveToLast() + * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 003 + */ it('testKvStoreResultSetMoveToLast003', 0, async function(done) { try { var moved = resultSet.moveToLast(123); @@ -339,6 +415,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0400 + * @tc.name [JS-API8]KvStoreResultSet.MoveToLast() + * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 004 + */ it('testKvStoreResultSetMoveToLast004', 0, async function(done) { try { var moved = resultSet.moveToLast(123, 'test_string'); @@ -350,7 +431,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // moveToNext(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0100 + * @tc.name [JS-API8]KvStoreResultSet.MoveToNext() + * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 001 + */ it('testKvStoreResultSetMoveToNext001', 0, async function(done) { try { var moved = resultSet.moveToNext(); @@ -363,6 +448,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0200 + * @tc.name [JS-API8]KvStoreResultSet.MoveToNext() + * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 002 + */ it('testKvStoreResultSetMoveToNext002', 0, async function(done) { try { var moved = resultSet.moveToNext(); @@ -377,6 +467,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0300 + * @tc.name [JS-API8]KvStoreResultSet.MoveToNext() + * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 003 + */ it('testKvStoreResultSetMoveToNext003', 0, async function(done) { try { var moved = resultSet.moveToNext(123); @@ -388,6 +483,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0400 + * @tc.name [JS-API8]KvStoreResultSet.MoveToNext() + * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 004 + */ it('testKvStoreResultSetMoveToNext004', 0, async function(done) { try { var moved = resultSet.moveToNext(123, 'test_string'); @@ -399,7 +499,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // moveToPrevious(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0100 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 001 + */ it('testKvStoreResultSetMoveToPrevious001', 0, async function(done) { try { var moved = resultSet.moveToPrevious(); @@ -412,6 +516,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0200 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 002 + */ it('testKvStoreResultSetMoveToPrevious002', 0, async function(done) { try { var moved = resultSet.moveToFirst(); @@ -429,6 +538,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0300 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 003 + */ it('testKvStoreResultSetMoveToPrevious003', 0, async function(done) { try { var moved = resultSet.moveToPrevious(123); @@ -440,6 +554,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0400 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 004 + */ it('testKvStoreResultSetMoveToPrevious004', 0, async function(done) { try { var moved = resultSet.moveToPrevious(123, 'test_string'); @@ -451,6 +570,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0500 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 005 + */ it('testKvStoreResultSetMoveToPrevious005', 0, async function(done) { try { var moved = resultSet.moveToFirst(); @@ -466,7 +590,12 @@ describe('KvStoreResultSetTest', function() { } done(); }) - // move(offset: number): boolean; + + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0100 + * @tc.name [JS-API8]KvStoreResultSet.Move() + * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 001 + */ it('testKvStoreResultSetMove001', 0, async function(done) { try { var moved = resultSet.move(); @@ -478,6 +607,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0200 + * @tc.name [JS-API8]KvStoreResultSet.Move() + * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 002 + */ it('testKvStoreResultSetMove002', 0, async function(done) { try { resultSet.moveToFirst(); @@ -493,6 +627,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0300 + * @tc.name [JS-API8]KvStoreResultSet.Move() + * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 003 + */ it('testKvStoreResultSetMove003', 0, async function(done) { try { expect(resultSet.getPosition() == -1).assertTrue(); @@ -509,6 +648,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0400 + * @tc.name [JS-API8]KvStoreResultSet.Move() + * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 004 + */ it('testKvStoreResultSetMove004', 0, async function(done) { try { var moved = resultSet.move(3, 'test_string'); @@ -520,7 +664,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // moveToPosition(position: number): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0100 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 001 + */ it('testKvStoreResultSetMoveToPosition001', 0, async function(done) { try { var moved = resultSet.moveToPosition(); @@ -532,6 +680,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0200 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 002 + */ it('testKvStoreResultSetMoveToPosition002', 0, async function(done) { try { var moved = resultSet.moveToPosition(1, 'test_string'); @@ -543,6 +696,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0300 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 003 + */ it('testKvStoreResultSetMoveToPosition003', 0, async function(done) { try { var moved = resultSet.moveToPosition(5); @@ -554,6 +712,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0400 + * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition() + * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 004 + */ it('testKvStoreResultSetMoveToPosition004', 0, async function(done) { try { var moved = resultSet.move(3); @@ -568,7 +731,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // isFirst(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0100 + * @tc.name [JS-API8]KvStoreResultSet.IsFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 001 + */ it('testKvStoreResultSetIsFirst001', 0, async function(done) { try { var flag = resultSet.isFirst(); @@ -581,6 +748,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0200 + * @tc.name [JS-API8]KvStoreResultSet.IsFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 002 + */ it('testKvStoreResultSetIsFirst002', 0, async function(done) { try { var flag = resultSet.isFirst(); @@ -597,6 +769,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0300 + * @tc.name [JS-API8]KvStoreResultSet.IsFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 003 + */ it('testKvStoreResultSetIsFirst003', 0, async function(done) { try { var flag = resultSet.isFirst(1); @@ -608,6 +785,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0400 + * @tc.name [JS-API8]KvStoreResultSet.IsFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 004 + */ it('testKvStoreResultSetIsFirst004', 0, async function(done) { try { var flag = resultSet.isFirst(1, 'test_string'); @@ -619,7 +801,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // isLast(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0100 + * @tc.name [JS-API8]KvStoreResultSet.IsLast() + * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 001 + */ it('testKvStoreResultSetIsLast001', 0, async function(done) { try { var flag = resultSet.isLast(); @@ -632,6 +818,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0200 + * @tc.name [JS-API8]KvStoreResultSet.IsLast() + * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 002 + */ it('testKvStoreResultSetIsLast002', 0, async function(done) { try { resultSet.moveToLast(); @@ -645,6 +836,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0300 + * @tc.name [JS-API8]KvStoreResultSet.IsLast() + * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 003 + */ it('testKvStoreResultSetIsLast003', 0, async function(done) { try { var flag = resultSet.isLast(1); @@ -656,6 +852,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0400 + * @tc.name [JS-API8]KvStoreResultSet.IsLast() + * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 004 + */ it('testKvStoreResultSetIsLast004', 0, async function(done) { try { var flag = resultSet.isLast(1, 'test_string'); @@ -667,7 +868,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // isBeforeFirst(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0100 + * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 001 + */ it('testKvStoreResultSetIsBeforeFirst001', 0, async function(done) { try { var flag = resultSet.isBeforeFirst(); @@ -680,6 +885,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0200 + * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 002 + */ it('testKvStoreResultSetIsBeforeFirst002', 0, async function(done) { try { var moved = resultSet.moveToPrevious(); @@ -694,6 +904,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0300 + * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 003 + */ it('testKvStoreResultSetIsBeforeFirst003', 0, async function(done) { try { var flag = resultSet.isBeforeFirst(1); @@ -705,6 +920,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0400 + * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst() + * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 004 + */ it('testKvStoreResultSetIsBeforeFirst004', 0, async function(done) { try { var flag = resultSet.isBeforeFirst(1, 'test_string'); @@ -716,7 +936,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // isAfterLast(): boolean; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0100 + * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast() + * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 001 + */ it('testKvStoreResultSetIsAfterLast001', 0, async function(done) { try { var flag = resultSet.isAfterLast(); @@ -729,6 +953,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0200 + * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast() + * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 002 + */ it('testKvStoreResultSetIsAfterLast002', 0, async function(done) { try { var moved = resultSet.moveToLast(); @@ -747,6 +976,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0300 + * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast() + * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 003 + */ it('testKvStoreResultSetIsAfterLast003', 0, async function(done) { try { var flag = resultSet.isAfterLast(1); @@ -758,6 +992,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0400 + * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast() + * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 004 + */ it('testKvStoreResultSetIsAfterLast004', 0, async function(done) { try { var flag = resultSet.isAfterLast(1, 'test_string'); @@ -769,7 +1008,11 @@ describe('KvStoreResultSetTest', function() { done(); }) - // getEntry(): Entry; + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0100 + * @tc.name [JS-API8]KvStoreResultSet.GetEntry() + * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 001 + */ it('testKvStoreResultSetGetEntry001', 0, async function(done) { try { var moved = resultSet.moveToNext(); @@ -784,6 +1027,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0200 + * @tc.name [JS-API8]KvStoreResultSet.GetEntry() + * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 002 + */ it('testKvStoreResultSetGetEntry002', 0, async function(done) { try { var moved = resultSet.moveToNext(); @@ -804,6 +1052,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0300 + * @tc.name [JS-API8]KvStoreResultSet.GetEntry() + * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 003 + */ it('testKvStoreResultSetGetEntry003', 0, async function(done) { try { var entry = resultSet.getEntry(1); @@ -815,6 +1068,11 @@ describe('KvStoreResultSetTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0400 + * @tc.name [JS-API8]KvStoreResultSet.GetEntry() + * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 004 + */ it('testKvStoreResultSetGetEntry004', 0, async function(done) { try { var entry = resultSet.getEntry(1, 'test_string'); diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/List.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/List.test.js index 40724a96d..eab653ec7 100755 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/List.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/List.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/QueryJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/QueryJsunit.test.js index d62ae8698..64ae8a9f8 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/QueryJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/QueryJsunit.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,10 +14,13 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import ddm from '@ohos.data.distributedData'; - describe('QueryTest', function() { - // reset + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_RESET_0100 + * @tc.name [JS-API8]Query.Reset(). + * @tc.desc Test Js Api Query.Reset() testcase 001 + */ it('testReset001', 0, async function(done) { try { let query = new ddm.Query(); @@ -36,6 +39,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_RESET_0200 + * @tc.name [JS-API8]Query.Reset(). + * @tc.desc Test Js Api Query.Reset() testcase 002 + */ it('testReset002', 0, async function(done) { try { let query = new ddm.Query(); @@ -59,6 +67,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_RESET_0300 + * @tc.name [JS-API8]Query.Reset(). + * @tc.desc Test Js Api Query.Reset() testcase 003 + */ it('testReset003', 0, async function(done) { try { let query = new ddm.Query(); @@ -77,6 +90,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_RESET_0400 + * @tc.name [JS-API8]Query.Reset(). + * @tc.desc Test Js Api Query.Reset() testcase 004 + */ it('testReset004', 0, async function(done) { try { let query = new ddm.Query(); @@ -92,15 +110,19 @@ describe('QueryTest', function() { done(); }) - // equalTo + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_EQAULTO_0100 + * @tc.name [JS-API8]Query.EqaulTo(). + * @tc.desc Test Js Api Query.EqaulTo() testcase 001 + */ it('testEqaulTo001', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.equalTo("key1", 5); // number - interger? - query.equalTo("key2", 5.0); // number - double? - query.equalTo("key3", false); // bool - query.equalTo("key3", "string");// string + query.equalTo("key1", 5); + query.equalTo("key2", 5.0); + query.equalTo("key3", false); + query.equalTo("key3", "string"); expect(query.getSqlLike() !== "").assertTrue(); console.log("query is " + query.getSqlLike()); query = null; @@ -111,6 +133,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_EQUALTO_0200 + * @tc.name [JS-API8]Query.EqualTo(). + * @tc.desc Test Js Api Query.EqualTo() testcase 002 + */ it('testEqualTo002', 0, async function(done) { try { let query = new ddm.Query(); @@ -126,6 +153,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_EQUALTO_0300 + * @tc.name [JS-API8]Query.EqualTo(). + * @tc.desc Test Js Api Query.EqualTo() testcase 003 + */ it('testEqualTo003', 0, async function(done) { try { let query = new ddm.Query(); @@ -139,6 +171,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_EQUALTO_0400 + * @tc.name [JS-API8]Query.EqualTo(). + * @tc.desc Test Js Api Query.EqualTo() testcase 004 + */ it('testEqualTo004', 0, async function(done) { try { let query = new ddm.Query(); @@ -154,15 +191,19 @@ describe('QueryTest', function() { done(); }) - // notEqualTo + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTEQUALTO_0100 + * @tc.name [JS-API8]Query.NotEqualTo(). + * @tc.desc Test Js Api Query.NotEqualTo() testcase 001 + */ it('testNotEqualTo001', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.notEqualTo("key1", 5); // number - interger? - query.notEqualTo("key2", 5.0); // number - double? - query.notEqualTo("key3", false); // bool - query.notEqualTo("key4", "string");// string + query.notEqualTo("key1", 5); + query.notEqualTo("key2", 5.0); + query.notEqualTo("key3", false); + query.notEqualTo("key4", "string"); expect(query.getSqlLike() !== "").assertTrue(); console.log("query is " + query.getSqlLike()); query = null; @@ -173,6 +214,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTEQUALTO_0200 + * @tc.name [JS-API8]Query.NotEqualTo(). + * @tc.desc Test Js Api Query.NotEqualTo() testcase 002 + */ it('testNotEqualTo002', 0, async function(done) { try { let query = new ddm.Query(); @@ -190,6 +236,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTEQUALTO_0300 + * @tc.name [JS-API8]Query.NotEqualTo(). + * @tc.desc Test Js Api Query.NotEqualTo() testcase 003 + */ it('testNotEqualTo003', 0, async function(done) { try { let query = new ddm.Query(); @@ -204,6 +255,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTEQUALTO_0400 + * @tc.name [JS-API8]Query.NotEqualTo(). + * @tc.desc Test Js Api Query.NotEqualTo() testcase 004 + */ it('testNotEqualTo004', 0, async function(done) { try { let query = new ddm.Query(); @@ -216,15 +272,19 @@ describe('QueryTest', function() { done(); }) - // greaterThan + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATERTHAN_0100 + * @tc.name [JS-API8]Query.GreaterThan(). + * @tc.desc Test Js Api Query.GreaterThan() testcase 001 + */ it('testGreaterThan001', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.greaterThan("key1", 5); // number - interger? - query.greaterThan("key2", 5.0); // number - double? - query.greaterThan("key3", true); // bool - query.greaterThan("key4", "string");// string + query.greaterThan("key1", 5); + query.greaterThan("key2", 5.0); + query.greaterThan("key3", true); + query.greaterThan("key4", "string"); expect(query.getSqlLike() !== "").assertTrue(); console.log("query is " + query.getSqlLike()); query = null; @@ -235,6 +295,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATTHAN_0200 + * @tc.name [JS-API8]Query.GreatThan(). + * @tc.desc Test Js Api Query.GreatThan() testcase 002 + */ it('testGreatThan002', 0, async function(done) { try { let query = new ddm.Query(); @@ -252,11 +317,16 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATTHAN_0300 + * @tc.name [JS-API8]Query.GreatThan(). + * @tc.desc Test Js Api Query.GreatThan() testcase 003 + */ it('testGreatThan003', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.greaterThan("key2", NaN); // how to get NaN? + query.greaterThan("key2", NaN); console.log("should throw exception on invalid arguments"); console.log("query is " + query.getSqlLike()); } catch (e) { @@ -265,6 +335,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATTHAN_0400 + * @tc.name [JS-API8]Query.GreatThan(). + * @tc.desc Test Js Api Query.GreatThan() testcase 004 + */ it('testGreatThan004', 0, async function(done) { try { let query = new ddm.Query(); @@ -278,15 +353,19 @@ describe('QueryTest', function() { done(); }) - // lessThan + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHAN_0100 + * @tc.name [JS-API8]Query.LessThan(). + * @tc.desc Test Js Api Query.LessThan() testcase 001 + */ it('testLessThan001', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.lessThan("key1", 5); // number - interger? - query.lessThan("key2", 5.0); // number - double? - query.lessThan("key3", true); // bool - query.lessThan("key4", "string");// string + query.lessThan("key1", 5); + query.lessThan("key2", 5.0); + query.lessThan("key3", true); + query.lessThan("key4", "string"); expect(query.getSqlLike() !== "").assertTrue(); console.log("query is " + query.getSqlLike()); query = null; @@ -296,6 +375,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHAN_0200 + * @tc.name [JS-API8]Query.LessThan(). + * @tc.desc Test Js Api Query.LessThan() testcase 002 + */ it('testLessThan002', 0, async function(done) { try { let query = new ddm.Query(); @@ -313,6 +397,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHAN_0300 + * @tc.name [JS-API8]Query.LessThan(). + * @tc.desc Test Js Api Query.LessThan() testcase 003 + */ it('testLessThan003', 0, async function(done) { try { let query = new ddm.Query(); @@ -325,6 +414,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHAN_0400 + * @tc.name [JS-API8]Query.LessThan(). + * @tc.desc Test Js Api Query.LessThan() testcase 004 + */ it('testLessThan004', 0, async function(done) { try { let query = new ddm.Query(); @@ -337,15 +431,20 @@ describe('QueryTest', function() { } done(); }) - // greaterThanOrEqualTo + + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATERTHANOREQUALTO_0100 + * @tc.name [JS-API8]Query.GreaterThanOrEqualTo(). + * @tc.desc Test Js Api Query.GreaterThanOrEqualTo() testcase 001 + */ it('testGreaterThanOrEqualTo001', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.greaterThanOrEqualTo("key1", 5); // number - interger? - query.greaterThanOrEqualTo("key2", 5.0); // number - double? - query.greaterThanOrEqualTo("key3", true); // bool - query.greaterThanOrEqualTo("key4", "string");// string + query.greaterThanOrEqualTo("key1", 5); + query.greaterThanOrEqualTo("key2", 5.0); + query.greaterThanOrEqualTo("key3", true); + query.greaterThanOrEqualTo("key4", "string"); expect(query.getSqlLike() !== "").assertTrue(); console.log("query is " + query.getSqlLike()); query = null; @@ -356,6 +455,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATERTHANOREQUALTO_0200 + * @tc.name [JS-API8]Query.GreaterThanOrEqualTo(). + * @tc.desc Test Js Api Query.GreaterThanOrEqualTo() testcase 002 + */ it('testGreaterThanOrEqualTo002', 0, async function(done) { try { let query = new ddm.Query(); @@ -375,6 +479,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATERTHANOREQUALTO_0300 + * @tc.name [JS-API8]Query.GreaterThanOrEqualTo(). + * @tc.desc Test Js Api Query.GreaterThanOrEqualTo() testcase 003 + */ it('testGreaterThanOrEqualTo003', 0, async function(done) { try { let query = new ddm.Query(); @@ -388,6 +497,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GREATERTHANOREQUALTO_0400 + * @tc.name [JS-API8]Query.GreaterThanOrEqualTo(). + * @tc.desc Test Js Api Query.GreaterThanOrEqualTo() testcase 004 + */ it('testGreaterThanOrEqualTo004', 0, async function(done) { try { let query = new ddm.Query(); @@ -401,15 +515,19 @@ describe('QueryTest', function() { done(); }) - // lessThanOrEqualTo + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHANOREQUALTO_0100 + * @tc.name [JS-API8]Query.LessThanOrEqualTo(). + * @tc.desc Test Js Api Query.LessThanOrEqualTo() testcase 001 + */ it('testLessThanOrEqualTo001', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - query.lessThanOrEqualTo("key1", 5); // number - interger? - query.lessThanOrEqualTo("key2", 5.0); // number - double? - query.lessThanOrEqualTo("key3", true); // bool - query.lessThanOrEqualTo("key4", "string");// string + query.lessThanOrEqualTo("key1", 5); + query.lessThanOrEqualTo("key2", 5.0); + query.lessThanOrEqualTo("key3", true); + query.lessThanOrEqualTo("key4", "string"); expect(query.getSqlLike() !== "").assertTrue(); console.log("query is " + query.getSqlLike()); query = null; @@ -420,6 +538,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHANOREQUALTO_0200 + * @tc.name [JS-API8]Query.LessThanOrEqualTo(). + * @tc.desc Test Js Api Query.LessThanOrEqualTo() testcase 002 + */ it('testLessThanOrEqualTo002', 0, async function(done) { try { let query = new ddm.Query(); @@ -437,6 +560,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHANOREQUALTO_0300 + * @tc.name [JS-API8]Query.LessThanOrEqualTo(). + * @tc.desc Test Js Api Query.LessThanOrEqualTo() testcase 003 + */ it('testLessThanOrEqualTo003', 0, async function(done) { try { let query = new ddm.Query(); @@ -449,6 +577,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LESSTHANOREQUALTO_0400 + * @tc.name [JS-API8]Query.LessThanOrEqualTo(). + * @tc.desc Test Js Api Query.LessThanOrEqualTo() testcase 004 + */ it('testLessThanOrEqualTo004', 0, async function(done) { try { let query = new ddm.Query(); @@ -462,7 +595,11 @@ describe('QueryTest', function() { done(); }) - // isNull + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNULL_0100 + * @tc.name [JS-API8]Query.IsNull(). + * @tc.desc Test Js Api Query.IsNull() testcase 001 + */ it('testIsNull001', 0, async function(done) { try { let query = new ddm.Query(); @@ -479,6 +616,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNULL_0200 + * @tc.name [JS-API8]Query.IsNull(). + * @tc.desc Test Js Api Query.IsNull() testcase 002 + */ it('testIsNull002', 0, async function(done) { try { let query = new ddm.Query(); @@ -494,6 +636,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNULL_0300 + * @tc.name [JS-API8]Query.IsNull(). + * @tc.desc Test Js Api Query.IsNull() testcase 003 + */ it('testIsNull003', 0, async function(done) { try { let query = new ddm.Query(); @@ -507,6 +654,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNULL_0400 + * @tc.name [JS-API8]Query.IsNull(). + * @tc.desc Test Js Api Query.IsNull() testcase 004 + */ it('testIsNull004', 0, async function(done) { try { let query = new ddm.Query(); @@ -536,7 +688,12 @@ describe('QueryTest', function() { * ======================================================================================= * Array | DOUBLE * not-typedArray treated as array of double. */ - // inNumber + + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INNUMBER_0100 + * @tc.name [JS-API8]Query.InNumber(). + * @tc.desc Test Js Api Query.InNumber() testcase 001 + */ it('testInNumber001', 0, async function(done) { try { let query = new ddm.Query(); @@ -581,6 +738,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INNUMBER_0200 + * @tc.name [JS-API8]Query.InNumber(). + * @tc.desc Test Js Api Query.InNumber() testcase 002 + */ it('testInNumber002', 0, async function(done) { try { let query = new ddm.Query(); @@ -599,6 +761,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INNUMBER_0300 + * @tc.name [JS-API8]Query.InNumber(). + * @tc.desc Test Js Api Query.InNumber() testcase 003 + */ it('testInNumber003', 0, async function(done) { try { let query = new ddm.Query(); @@ -612,6 +779,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INNUMBER_0400 + * @tc.name [JS-API8]Query.InNumber(). + * @tc.desc Test Js Api Query.InNumber() testcase 004 + */ it('testInNumber004', 0, async function(done) { try { let query = new ddm.Query(); @@ -625,19 +797,19 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INNUMBER_0500 + * @tc.name [JS-API8]Query.InNumber(). + * @tc.desc Test Js Api Query.InNumber() testcase 005 + */ it('testInNumber005', 0, async function(done) { try { let query = new ddm.Query(); expect("").assertEqual(query.getSqlLike()); - - // var u64 = new BigUint64Array([21n, 31n]); // build error. - var u64 = new BigUint64Array([21, 31]); // cannot convert to bigint + var u64 = new BigUint64Array([21, 31]); query.inNumber("key", u64); - - // var b64 = new BigInt64Array([21n, 31n]); // build error. - var b64 = new BigInt64Array([21, 31]); // cannot convert to bigint + var b64 = new BigInt64Array([21, 31]); query.inNumber("key", b64); - console.log("should throw exception on invalid arguments"); expect(null).assertFail(); } catch (e) { @@ -646,32 +818,31 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INNUMBER_0600 + * @tc.name [JS-API8]Query.InNumber(). + * @tc.desc Test Js Api Query.InNumber() testcase 006 + */ it('testInNumber006', 0, async function(done) { try { let query = new ddm.Query(); - // no-typedArray treat as array of double. console.log("typeof([1, 2, 97])" + typeof([1, 2, 97])) console.log("typeof([1, 2, 97][0])" + typeof([1, 2, 97][0])) query.inNumber("key", [1, 2, 97]); console.log("inNumber([1, 2, 97]) => " + query.getSqlLike()); query.reset(); - query.inNumber("key1", [-1, 3, 987654.123, 0xabc123456]); console.log("inNumber([1, 2, 0xa1234567890123456]) => " + query.getSqlLike()); query.reset(); - query.inNumber("key2", [-1, 3, -987654.123, 0xabc123456]); console.log("inNumber([1, 2, 0xa1234567890123456]) => " + query.getSqlLike()); query.reset(); - query.inNumber("key3", [-1, 4, -987654.123, Number.MAX_VALUE]); console.log("inNumber([1, 2, Number.MAX_VALUE]) => " + query.getSqlLike()); query.reset(); - query.inNumber("key4", [1, -2.3, Number.MIN_VALUE, Number.MAX_VALUE]); console.log("inNumber([1, -2.3, Number.MAX_VALUE]) => " + query.getSqlLike()); expect(query.getSqlLike() !== "").assertTrue(); - console.log("query is " + query.getSqlLike()); query.reset(); query = null; @@ -682,7 +853,11 @@ describe('QueryTest', function() { done(); }) - // inString + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INSTRING_0100 + * @tc.name [JS-API8]Query.InString(). + * @tc.desc Test Js Api Query.InString() testcase 001 + */ it('testInString001', 0, async function(done) { try { let query = new ddm.Query(); @@ -699,6 +874,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INSTRING_0200 + * @tc.name [JS-API8]Query.InString(). + * @tc.desc Test Js Api Query.InString() testcase 002 + */ it('testInString002', 0, async function(done) { try { let query = new ddm.Query(); @@ -716,6 +896,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INSTRING_0300 + * @tc.name [JS-API8]Query.InString(). + * @tc.desc Test Js Api Query.InString() testcase 003 + */ it('testInString003', 0, async function(done) { try { let query = new ddm.Query(); @@ -729,6 +914,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_INSTRING_0400 + * @tc.name [JS-API8]Query.InString(). + * @tc.desc Test Js Api Query.InString() testcase 004 + */ it('testInString004', 0, async function(done) { try { let query = new ddm.Query(); @@ -742,7 +932,11 @@ describe('QueryTest', function() { done(); }) - // notInNumber + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINNUMBER_0100 + * @tc.name [JS-API8]Query.NotInNumber(). + * @tc.desc Test Js Api Query.NotInNumber() testcase 001 + */ it('testNotInNumber001', 0, async function(done) { try { let query = new ddm.Query(); @@ -759,6 +953,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINNUMBER_0200 + * @tc.name [JS-API8]Query.NotInNumber(). + * @tc.desc Test Js Api Query.NotInNumber() testcase 002 + */ it('testNotInNumber002', 0, async function(done) { try { let query = new ddm.Query(); @@ -774,6 +973,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINNUMBER_0300 + * @tc.name [JS-API8]Query.NotInNumber(). + * @tc.desc Test Js Api Query.NotInNumber() testcase 003 + */ it('testNotInNumber003', 0, async function(done) { try { let query = new ddm.Query(); @@ -787,6 +991,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINNUMBER_0400 + * @tc.name [JS-API8]Query.NotInNumber(). + * @tc.desc Test Js Api Query.NotInNumber() testcase 004 + */ it('testNotInNumber004', 0, async function(done) { try { let query = new ddm.Query(); @@ -801,7 +1010,11 @@ describe('QueryTest', function() { done(); }) - // notInString + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINSTRING_0100 + * @tc.name [JS-API8]Query.NotInString(). + * @tc.desc Test Js Api Query.NotInString() testcase 001 + */ it('testNotInString001', 0, async function(done) { try { let query = new ddm.Query(); @@ -818,6 +1031,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINSTRING_0200 + * @tc.name [JS-API8]Query.NotInString(). + * @tc.desc Test Js Api Query.NotInString() testcase 002 + */ it('testNotInString002', 0, async function(done) { try { let query = new ddm.Query(); @@ -833,6 +1051,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINSTRING_0300 + * @tc.name [JS-API8]Query.NotInString(). + * @tc.desc Test Js Api Query.NotInString() testcase 003 + */ it('testNotInString003', 0, async function(done) { try { let query = new ddm.Query(); @@ -846,6 +1069,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_NOTINSTRING_0400 + * @tc.name [JS-API8]Query.NotInString(). + * @tc.desc Test Js Api Query.NotInString() testcase 004 + */ it('testNotInString004', 0, async function(done) { try { let query = new ddm.Query(); @@ -859,7 +1087,11 @@ describe('QueryTest', function() { done(); }) - // like + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIKE_0100 + * @tc.name [JS-API8]Query.Like(). + * @tc.desc Test Js Api Query.Like() testcase 001 + */ it('testLike001', 0, async function(done) { try { let query = new ddm.Query(); @@ -876,6 +1108,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIKE_0200 + * @tc.name [JS-API8]Query.Like(). + * @tc.desc Test Js Api Query.Like() testcase 002 + */ it('testLike002', 0, async function(done) { try { let query = new ddm.Query(); @@ -891,6 +1128,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIKE_0300 + * @tc.name [JS-API8]Query.Like(). + * @tc.desc Test Js Api Query.Like() testcase 003 + */ it('testLike003', 0, async function(done) { try { let query = new ddm.Query(); @@ -904,6 +1146,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIKE_0400 + * @tc.name [JS-API8]Query.Like(). + * @tc.desc Test Js Api Query.Like() testcase 004 + */ it('testLike004', 0, async function(done) { try { let query = new ddm.Query(); @@ -917,7 +1164,11 @@ describe('QueryTest', function() { done(); }) - // unlike + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_UNLIKE_0100 + * @tc.name [JS-API8]Query.Unlike(). + * @tc.desc Test Js Api Query.Unlike() testcase 001 + */ it('testUnlike001', 0, async function(done) { try { let query = new ddm.Query(); @@ -933,6 +1184,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_UNLIKE_0200 + * @tc.name [JS-API8]Query.Unlike(). + * @tc.desc Test Js Api Query.Unlike() testcase 002 + */ it('testUnlike002', 0, async function(done) { try { let query = new ddm.Query(); @@ -948,6 +1204,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_UNLIKE_0300 + * @tc.name [JS-API8]Query.Unlike(). + * @tc.desc Test Js Api Query.Unlike() testcase 003 + */ it('testUnlike003', 0, async function(done) { try { let query = new ddm.Query(); @@ -961,6 +1222,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_UNLIKE_0400 + * @tc.name [JS-API8]Query.Unlike(). + * @tc.desc Test Js Api Query.Unlike() testcase 004 + */ it('testUnlike004', 0, async function(done) { try { let query = new ddm.Query(); @@ -974,7 +1240,11 @@ describe('QueryTest', function() { done(); }) - // and + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_AND_0100 + * @tc.name [JS-API8]Query.And(). + * @tc.desc Test Js Api Query.And() testcase 001 + */ it('testAnd001', 0, async function(done) { try { let query = new ddm.Query(); @@ -992,6 +1262,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_AND_0200 + * @tc.name [JS-API8]Query.And(). + * @tc.desc Test Js Api Query.And() testcase 002 + */ it('testAnd002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1007,6 +1282,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_AND_0300 + * @tc.name [JS-API8]Query.And(). + * @tc.desc Test Js Api Query.And() testcase 003 + */ it('testAnd003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1022,6 +1302,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_AND_0400 + * @tc.name [JS-API8]Query.And(). + * @tc.desc Test Js Api Query.And() testcase 004 + */ it('testAnd004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1035,7 +1320,11 @@ describe('QueryTest', function() { done(); }) - // or + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_OR_0100 + * @tc.name [JS-API8]Query.Or(). + * @tc.desc Test Js Api Query.Or() testcase 001 + */ it('testOr001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1053,6 +1342,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_OR_0200 + * @tc.name [JS-API8]Query.Or(). + * @tc.desc Test Js Api Query.Or() testcase 002 + */ it('testOr002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1069,6 +1363,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_OR_0300 + * @tc.name [JS-API8]Query.Or(). + * @tc.desc Test Js Api Query.Or() testcase 003 + */ it('testOr003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1086,6 +1385,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_OR_0400 + * @tc.name [JS-API8]Query.Or(). + * @tc.desc Test Js Api Query.Or() testcase 004 + */ it('testOr004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1099,7 +1403,11 @@ describe('QueryTest', function() { done(); }) - // orderByAsc + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYASC_0100 + * @tc.name [JS-API8]Query.OrderByAsc(). + * @tc.desc Test Js Api Query.OrderByAsc() testcase 001 + */ it('testOrderByAsc001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1116,6 +1424,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYASC_0200 + * @tc.name [JS-API8]Query.OrderByAsc(). + * @tc.desc Test Js Api Query.OrderByAsc() testcase 002 + */ it('testOrderByAsc002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1131,6 +1444,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYASC_0300 + * @tc.name [JS-API8]Query.OrderByAsc(). + * @tc.desc Test Js Api Query.OrderByAsc() testcase 003 + */ it('testOrderByAsc003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1144,6 +1462,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYASC_0400 + * @tc.name [JS-API8]Query.OrderByAsc(). + * @tc.desc Test Js Api Query.OrderByAsc() testcase 004 + */ it('testOrderByAsc004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1157,7 +1480,11 @@ describe('QueryTest', function() { done(); }) - // orderByDesc + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYDESC_0100 + * @tc.name [JS-API8]Query.OrderByDesc(). + * @tc.desc Test Js Api Query.OrderByDesc() testcase 001 + */ it('testOrderByDesc001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1174,6 +1501,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYDESC_0200 + * @tc.name [JS-API8]Query.OrderByDesc(). + * @tc.desc Test Js Api Query.OrderByDesc() testcase 002 + */ it('testOrderByDesc002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1189,6 +1521,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYDESC_0300 + * @tc.name [JS-API8]Query.OrderByDesc(). + * @tc.desc Test Js Api Query.OrderByDesc() testcase 003 + */ it('testOrderByDesc003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1202,6 +1539,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ORDERBYDESC_0400 + * @tc.name [JS-API8]Query.OrderByDesc(). + * @tc.desc Test Js Api Query.OrderByDesc() testcase 004 + */ it('testOrderByDesc004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1215,7 +1557,11 @@ describe('QueryTest', function() { done(); }) - // limit(total:number, offset:number) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIMIT_0100 + * @tc.name [JS-API8]Query.Limit(). + * @tc.desc Test Js Api Query.Limit() testcase 001 + */ it('testLimit001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1232,6 +1578,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIMIT_0200 + * @tc.name [JS-API8]Query.Limit(). + * @tc.desc Test Js Api Query.Limit() testcase 002 + */ it('testLimit002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1248,6 +1599,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIMIT_0300 + * @tc.name [JS-API8]Query.Limit(). + * @tc.desc Test Js Api Query.Limit() testcase 003 + */ it('testLimit003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1263,6 +1619,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIMIT_0400 + * @tc.name [JS-API8]Query.Limit(). + * @tc.desc Test Js Api Query.Limit() testcase 004 + */ it('testLimit004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1276,6 +1637,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_LIMIT_0500 + * @tc.name [JS-API8]Query.Limit(). + * @tc.desc Test Js Api Query.Limit() testcase 005 + */ it('testLimit005', 0, async function(done) { try { let query = new ddm.Query(); @@ -1291,7 +1657,11 @@ describe('QueryTest', function() { done(); }) - // isNotNull + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNOTNULL_0100 + * @tc.name [JS-API8]Query.IsNotNull(). + * @tc.desc Test Js Api Query.IsNotNull() testcase 001 + */ it('testIsNotNull001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1307,6 +1677,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNOTNULL_0200 + * @tc.name [JS-API8]Query.IsNotNull(). + * @tc.desc Test Js Api Query.IsNotNull() testcase 002 + */ it('testIsNotNull002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1322,6 +1697,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNOTNULL_0300 + * @tc.name [JS-API8]Query.IsNotNull(). + * @tc.desc Test Js Api Query.IsNotNull() testcase 003 + */ it('testIsNotNull003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1335,6 +1715,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ISNOTNULL_0400 + * @tc.name [JS-API8]Query.IsNotNull(). + * @tc.desc Test Js Api Query.IsNotNull() testcase 004 + */ it('testIsNotNull004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1348,7 +1733,11 @@ describe('QueryTest', function() { done(); }) - // beginGroup + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_BEGINGROUP_0100 + * @tc.name [JS-API8]Query.BeginGroup(). + * @tc.desc Test Js Api Query.BeginGroup() testcase 001 + */ it('testBeginGroup001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1366,6 +1755,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_BEGINGROUP_0200 + * @tc.name [JS-API8]Query.BeginGroup(). + * @tc.desc Test Js Api Query.BeginGroup() testcase 002 + */ it('testBeginGroup002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1385,6 +1779,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_BEGINGROUP_0300 + * @tc.name [JS-API8]Query.BeginGroup(). + * @tc.desc Test Js Api Query.BeginGroup() testcase 003 + */ it('testBeginGroup003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1398,6 +1797,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_BEGINGROUP_0400 + * @tc.name [JS-API8]Query.BeginGroup(). + * @tc.desc Test Js Api Query.BeginGroup() testcase 004 + */ it('testBeginGroup004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1411,7 +1815,11 @@ describe('QueryTest', function() { done(); }) - // endGroup + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ENDGROUP_0100 + * @tc.name [JS-API8]Query.EndGroup(). + * @tc.desc Test Js Api Query.EndGroup() testcase 001 + */ it('testEndGroup001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1428,6 +1836,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ENDGROUP_0200 + * @tc.name [JS-API8]Query.EndGroup(). + * @tc.desc Test Js Api Query.EndGroup() testcase 002 + */ it('testEndGroup002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1445,6 +1858,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ENDGROUP_0300 + * @tc.name [JS-API8]Query.EndGroup(). + * @tc.desc Test Js Api Query.EndGroup() testcase 003 + */ it('testEndGroup003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1458,6 +1876,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_ENDGROUP_0400 + * @tc.name [JS-API8]Query.EndGroup(). + * @tc.desc Test Js Api Query.EndGroup() testcase 004 + */ it('testEndGroup004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1471,7 +1894,11 @@ describe('QueryTest', function() { done(); }) - // prefixKey + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_PREFIXKEY_0100 + * @tc.name [JS-API8]Query.PrefixKey(). + * @tc.desc Test Js Api Query.PrefixKey() testcase 001 + */ it('testPrefixKey001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1487,6 +1914,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_PREFIXKEY_0200 + * @tc.name [JS-API8]Query.PrefixKey(). + * @tc.desc Test Js Api Query.PrefixKey() testcase 002 + */ it('testPrefixKey002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1501,6 +1933,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_PREFIXKEY_0300 + * @tc.name [JS-API8]Query.PrefixKey(). + * @tc.desc Test Js Api Query.PrefixKey() testcase 003 + */ it('testPrefixKey003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1514,6 +1951,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_PREFIXKEY_0400 + * @tc.name [JS-API8]Query.PrefixKey(). + * @tc.desc Test Js Api Query.PrefixKey() testcase 004 + */ it('testPrefixKey004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1527,7 +1969,11 @@ describe('QueryTest', function() { done(); }) - // setSuggestIndex(index:string) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_SETSUGGESTINDEX_0100 + * @tc.name [JS-API8]Query.SetSuggestIndex(). + * @tc.desc Test Js Api Query.SetSuggestIndex() testcase 001 + */ it('testSetSuggestIndex001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1543,6 +1989,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_SETSUGGESTINDEX_0200 + * @tc.name [JS-API8]Query.SetSuggestIndex(). + * @tc.desc Test Js Api Query.SetSuggestIndex() testcase 002 + */ it('testSetSuggestIndex002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1557,6 +2008,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_SETSUGGESTINDEX_0300 + * @tc.name [JS-API8]Query.SetSuggestIndex(). + * @tc.desc Test Js Api Query.SetSuggestIndex() testcase 003 + */ it('testSetSuggestIndex003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1570,6 +2026,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_SETSUGGESTINDEX_0400 + * @tc.name [JS-API8]Query.SetSuggestIndex(). + * @tc.desc Test Js Api Query.SetSuggestIndex() testcase 004 + */ it('testSetSuggestIndex004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1583,7 +2044,11 @@ describe('QueryTest', function() { done(); }) - // deviceId + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_DEVICEID_0100 + * @tc.name [JS-API8]Query.DeviceId(). + * @tc.desc Test Js Api Query.DeviceId() testcase 001 + */ it('testDeviceId001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1600,6 +2065,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_DEVICEID_0200 + * @tc.name [JS-API8]Query.DeviceId(). + * @tc.desc Test Js Api Query.DeviceId() testcase 002 + */ it('testDeviceId002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1615,6 +2085,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_DEVICEID_0300 + * @tc.name [JS-API8]Query.DeviceId(). + * @tc.desc Test Js Api Query.DeviceId() testcase 003 + */ it('testDeviceId003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1628,6 +2103,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_DEVICEID_0400 + * @tc.name [JS-API8]Query.DeviceId(). + * @tc.desc Test Js Api Query.DeviceId() testcase 004 + */ it('testDeviceId004', 0, async function(done) { try { let query = new ddm.Query(); @@ -1641,7 +2121,11 @@ describe('QueryTest', function() { done(); }) - // getSqlLike + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GETSQLLIKE_0100 + * @tc.name [JS-API8]Query.GetSqlLike(). + * @tc.desc Test Js Api Query.GetSqlLike() testcase 001 + */ it('testGetSqlLike001', 0, async function(done) { try { let query = new ddm.Query(); @@ -1659,6 +2143,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GETSQLLIKE_0200 + * @tc.name [JS-API8]Query.GetSqlLike(). + * @tc.desc Test Js Api Query.GetSqlLike() testcase 002 + */ it('testGetSqlLike002', 0, async function(done) { try { let query = new ddm.Query(); @@ -1680,6 +2169,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GETSQLLIKE_0300 + * @tc.name [JS-API8]Query.GetSqlLike(). + * @tc.desc Test Js Api Query.GetSqlLike() testcase 003 + */ it('testGetSqlLike003', 0, async function(done) { try { let query = new ddm.Query(); @@ -1694,6 +2188,11 @@ describe('QueryTest', function() { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_QUERY_GETSQLLIKE_0400 + * @tc.name [JS-API8]Query.GetSqlLike(). + * @tc.desc Test Js Api Query.GetSqlLike() testcase 004 + */ it('testGetSqlLike004', 0, async function(done) { try { let query = new ddm.Query(); diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js index 38110bf00..2c19f8ded 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,81 +16,248 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import ddm from '@ohos.data.distributedData'; const TEST_BUNDLE_NAME = 'ohos.acts.distributeddatamgr'; +const TEST_STORE_ID = 'storeId'; -const config = { - bundleName : TEST_BUNDLE_NAME, - userInfo : { - userId : '0', - userType : ddm.UserType.SAME_USER_ID +var kvManager = null; +var kvStore = null; + +function putBatchString(len, prefix) { + let entries = []; + for (var i = 0; i < len; i++) { + entries.push({ + key : prefix + i, + value : { + type : ddm.ValueType.STRING, + value : '{"english":{"first":"leda' + i + '", "second":"yang"}}' + } + }); + } + return entries; +} + +async function testPutAndGet(kvManager, options) { + try { + await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { + console.log('testPutAndGet getKVStore success' + JSON.stringify(options)); + kvStore = store; + expect(store != null).assertTrue(); + }).catch((err) => { + console.log('testPutAndGet getKVStore fail ' + err); + expect(null).assertFail(); + }); + var canGet = new Promise((resolve, reject) => { + kvStore.on('dataChange', 0, function (data) { + console.log('testPutAndGet resolve on data change: ' + JSON.stringify(data)); + resolve(data.deviceId); + }); + let entries = putBatchString(10, 'test_key_'); + kvStore.putBatch(entries).then((data) => { + console.log('testPutAndGet put success'); + expect(data == undefined).assertTrue(); + }); + setTimeout(() => { + reject(new Error('not resolved in 2 second, reject it.')) + }, 2000); + }); + await canGet.then(async function(deviceId) { + var query = new ddm.Query(); + query.prefixKey('test_key_'); + query.like('$.english.first', 'led%'); + if (options.kvStoreType == ddm.KVStoreType.DEVICE_COLLABORATION) { + console.log('testPutAndGet deviceId = ' + deviceId); + query.deviceId(deviceId); + } + await kvStore.getEntries(query).then((entries) => { + console.log('testPutAndGet get success : ' + JSON.stringify(entries)); + expect(entries.length == 10).assertTrue(); + }).catch((err) => { + console.log('testPutAndGet get fail ' + err); + expect(null).assertFail(); + }); + }).catch((error) => { + console.log('testPutAndGet canGet fail: ' + error); + expect(null).assertFail(); + }); + } catch (e) { + console.log('testPutAndGet get exception: ' + e); } } describe('SchemaTest', function() { + const config = { + bundleName : TEST_BUNDLE_NAME, + userInfo : { + userId : '0', + userType : ddm.UserType.SAME_USER_ID + } + } + + var options = { + createIfMissing : true, + encrypt : false, + backup : false, + autoSync : true, + kvStoreType : ddm.KVStoreType.SINGLE_VERSION, + schema : '', + securityLevel : ddm.SecurityLevel.NO_LEVEL, + } + + beforeAll(async function (done) { + try { + console.log("beforeAll: createKVManager (single) with " + JSON.stringify(options)); + await ddm.createKVManager(config).then((manager) => { + kvManager = manager; + console.log('beforeAll createKVManager success'); + }).catch((err) => { + console.log('beforeAll createKVManager err ' + err); + }); + } catch (e) { + console.log("fail on exception: " + e); + expect(null).assertFail(); + } + done(); + }) - // toJsonString():string + afterAll(async function (done) { + console.log('afterAll'); + kvManager = null; + kvStore = null; + done(); + }) + + beforeEach(async function (done) { + console.log('beforeEach testcase will update options:' + JSON.stringify(options)); + done(); + }) + + afterEach(async function (done) { + console.log('afterEach'); + await kvManager.closeKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID, kvStore).then(async () => { + console.log('afterEach closeKVStore success'); + await kvManager.deleteKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID).then(() => { + console.log('afterEach deleteKVStore success'); + kvStore = null; + }).catch((err) => { + console.log('afterEach deleteKVStore err ' + err); + }); + }).catch((err) => { + console.log('afterEach closeKVStore err ' + err); + }); + done(); + }) + + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SCHEMA_TOJSONSTRING_0100 + * @tc.name [JS-API8]Schema.ToJsonString() + * @tc.desc Test Js Api Schema.ToJsonString() testcase 001 + */ it('testToJsonString001', 0, async function(done) { try { + let first = new ddm.FieldNode('first'); + first.type = ddm.ValueType.STRING; + first.nullable = false; + first.default = 'first name'; + + let second = new ddm.FieldNode('second'); + second.type = ddm.ValueType.STRING; + second.nullable = false; + second.default = 'second name'; + + let english = new ddm.FieldNode('english'); + english.type = ddm.ValueType.STRING; + english.appendChild(first); + english.appendChild(second); + let schema = new ddm.Schema(); - var str = schema.toJsonString(); - console.log("schema: " + str); + schema.root.appendChild(english); + schema.indexes = ['$.english.first', '$.english.second']; + console.log("schema: " + schema.toJsonString()); } catch (e) { + console.log("schema fail on exception: " + e); expect(null).assertFail(); } done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SCHEMA_TOJSONSTRING_0200 + * @tc.name [JS-API8]Schema.ToJsonString() + * @tc.desc Test Js Api Schema.ToJsonString() testcase 002 + */ it('testToJsonString002', 0, async function(done) { try { + let first = new ddm.FieldNode('first'); + first.type = ddm.ValueType.STRING; + first.nullable = false; + first.default = 'first name'; + + let second = new ddm.FieldNode('second'); + second.type = ddm.ValueType.STRING; + second.nullable = false; + second.default = 'second name'; + + let english = new ddm.FieldNode('english'); + english.type = ddm.ValueType.STRING; + english.appendChild(first); + english.appendChild(second); + let schema = new ddm.Schema(); - var str = schema.toJsonString(); - console.log("testToJsonString002: " + str); - const options = { - createIfMissing : true, - encrypt : false, - backup : false, - autoSync : true, - kvStoreType : ddm.KVStoreType.SINGLE_VERSION, - schema : str, - securityLevel : ddm.SecurityLevel.S2, - } - console.log("testToJsonString002: createKVManager (single) with " + JSON.stringify(options)); - await ddm.createKVManager(config).then((manager) => { - var kvManager = manager; - console.log('testToJsonString002 createKVManager success'); - }).catch((err) => { - console.log('testToJsonString002 createKVManager err ' + err); - }); + schema.root.appendChild(english); + schema.indexes = ['$.english.first', '$.english.second']; + console.log("schema: " + schema.toJsonString()); + options.kvStoreType = ddm.KVStoreType.DEVICE_COLLABORATION; + options.schema = schema.toJsonString(); + await testPutAndGet(kvManager, options); + console.log("schematestPutAndGet done"); } catch (e) { + console.log("schema fail on exception: " + e); expect(null).assertFail(); } done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SCHEMA_TOJSONSTRING_0300 + * @tc.name [JS-API8]Schema.ToJsonString() + * @tc.desc Test Js Api Schema.ToJsonString() testcase 003 + */ it('testToJsonString003', 0, async function(done) { try { + let name = new ddm.FieldNode('name'); + name.type = ddm.ValueType.INTEGER; + name.nullable = false; + name.default = 0; + let schema = new ddm.Schema(); - var str = schema.toJsonString(); - console.log("testToJsonString003: " + str); - - const options = { - createIfMissing : true, - encrypt : false, - backup : false, - autoSync : true, - kvStoreType : ddm.KVStoreType.DEVICE_COLLABORATION, - schema : str, - securityLevel : ddm.SecurityLevel.S2, - } - console.log("testToJsonString003: createKVManager (device) with " + JSON.stringify(options)); - await ddm.createKVManager(config).then((manager) => { - var kvManager = manager; - console.log('testToJsonString003 createKVManager success'); + schema.root.appendChild(name); + schema.indexes = ['$.name']; + schema.mode = 1; // STRICT + console.log("schema: " + schema.toJsonString()); + options.kvStoreType = ddm.KVStoreType.SINGLE_VERSION; + options.schema = schema.toJsonString(); + await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { + console.log('testToJsonString003 getKVStore success' + JSON.stringify(options)); + kvStore = store; + expect(store != null).assertTrue(); + await kvStore.put("test_key_1", '{"name":1}'); + await kvStore.put("test_key_2", '{"name":2}'); + await kvStore.put("test_key_3", '{"name":3}'); + console.log('testToJsonString003 Put success'); + }); + console.log('testToJsonString003 start Query ...'); + var query = new ddm.Query(); + query.prefixKey('test_key_'); + query.notEqualTo("$.name", 3); + await kvStore.getEntries(query).then((entries) => { + console.log('testToJsonString003 get success : ' + JSON.stringify(entries)); + expect(entries.length == 2).assertTrue(); }).catch((err) => { - console.log('testToJsonString003 createKVManager err ' + err); + console.log('testToJsonString003 get fail ' + err); + expect(null).assertFail(); }); - } catch (e) { + console.log("testToJsonString003 fail on exception: " + e); expect(null).assertFail(); } done(); diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js index 4347f0ac0..9aa1dc4ee 100755 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -106,6 +106,11 @@ describe('SingleKvStoreCallbackTest', function () { }); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTSTRING_1010 + * @tc.name [JS-API8]SingleKvStore.Put(String) + * @tc.desc Test Js Api SingleKvStore.Put(String) testcase 101 + */ it('testSingleKvStorePutString101', 0, async function (done) { console.log('testSingleKvStorePutString101'); try { @@ -125,6 +130,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTSTRING_1020 + * @tc.name [JS-API8]SingleKvStore.Put(String) + * @tc.desc Test Js Api SingleKvStore.Put(String) testcase 102 + */ it('testSingleKvStorePutString102', 0, async function (done) { console.log('testSingleKvStorePutString102'); try { @@ -148,6 +158,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSTRING_1010 + * @tc.name [JS-API8]SingleKvStore.GetString() + * @tc.desc Test Js Api SingleKvStore.GetString() testcase 101 + */ it('testSingleKvStoreGetString101', 0, async function (done) { console.log('testSingleKvStoreGetString101'); try{ @@ -167,6 +182,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSTRING_1020 + * @tc.name [JS-API8]SingleKvStore.GetString() + * @tc.desc Test Js Api SingleKvStore.GetString() testcase 102 + */ it('testSingleKvStoreGetString102', 0, async function (done) { console.log('testSingleKvStoreGetString102'); try{ @@ -186,6 +206,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_1010 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 101 + */ it('testSingleKvStorePutInt101', 0, async function (done) { console.log('testSingleKvStorePutInt101'); try { @@ -205,6 +230,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_1020 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 102 + */ it('testSingleKvStorePutInt102', 0, async function (done) { console.log('testSingleKvStorePutInt102'); try { @@ -225,6 +255,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_1030 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 103 + */ it('testSingleKvStorePutInt103', 0, async function (done) { console.log('testSingleKvStorePutInt103'); try { @@ -245,6 +280,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_1040 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 104 + */ it('testSingleKvStorePutInt104', 0, async function (done) { console.log('testSingleKvStorePutInt104'); try { @@ -265,6 +305,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETINT_1010 + * @tc.name [JS-API8]SingleKvStore.GetInt() + * @tc.desc Test Js Api SingleKvStore.GetInt() testcase 101 + */ it('testSingleKvStoreGetInt101', 0, async function (done) { console.log('testSingleKvStoreGetInt101'); try { @@ -284,6 +329,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETINT_1020 + * @tc.name [JS-API8]SingleKvStore.GetInt() + * @tc.desc Test Js Api SingleKvStore.GetInt() testcase 102 + */ it('testSingleKvStoreGetInt102', 0, async function (done) { console.log('testSingleKvStoreGetInt102'); try { @@ -303,6 +353,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBOOL_1010 + * @tc.name [JS-API8]SingleKvStore.Put(Bool) + * @tc.desc Test Js Api SingleKvStore.Put(Bool) testcase 101 + */ it('testSingleKvStorePutBool101', 0, async function (done) { console.log('testSingleKvStorePutBool101'); try { @@ -318,6 +373,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETBOOL_1010 + * @tc.name [JS-API8]SingleKvStore.GetBool() + * @tc.desc Test Js Api SingleKvStore.GetBool() testcase 101 + */ it('testSingleKvStoreGetBool101', 0, async function (done) { console.log('testSingleKvStoreGetBool101'); try { @@ -337,6 +397,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETBOOL_1020 + * @tc.name [JS-API8]SingleKvStore.GetBool() + * @tc.desc Test Js Api SingleKvStore.GetBool() testcase 102 + */ it('testSingleKvStoreGetBool102', 0, async function (done) { console.log('testSingleKvStoreGetBool102'); try { @@ -356,6 +421,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTFLOAT_1010 + * @tc.name [JS-API8]SingleKvStore.Put(Float) + * @tc.desc Test Js Api SingleKvStore.Put(Float) testcase 101 + */ it('testSingleKvStorePutFloat101', 0, async function (done) { console.log('testSingleKvStorePutFloat101'); try { @@ -371,6 +441,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTFLOAT_1020 + * @tc.name [JS-API8]SingleKvStore.Put(Float) + * @tc.desc Test Js Api SingleKvStore.Put(Float) testcase 102 + */ it('testSingleKvStorePutFloat102', 0, async function (done) { console.log('testSingleKvStorePutFloat102'); try { @@ -392,6 +467,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTFLOAT_1030 + * @tc.name [JS-API8]SingleKvStore.Put(Float) + * @tc.desc Test Js Api SingleKvStore.Put(Float) testcase 103 + */ it('testSingleKvStorePutFloat103', 0, async function (done) { console.log('testSingleKvStorePutFloat103'); try { @@ -413,6 +493,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTFLOAT_1040 + * @tc.name [JS-API8]SingleKvStore.Put(Float) + * @tc.desc Test Js Api SingleKvStore.Put(Float) testcase 104 + */ it('testSingleKvStorePutFloat104', 0, async function (done) { console.log('testSingleKvStorePutFloat104'); try { @@ -434,6 +519,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETFLOAT_1010 + * @tc.name [JS-API8]SingleKvStore.GetFloat() + * @tc.desc Test Js Api SingleKvStore.GetFloat() testcase 101 + */ it('testSingleKvStoreGetFloat101', 0, async function (done) { console.log('testSingleKvStoreGetFloat101'); try { @@ -453,6 +543,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETESTRING_1010 + * @tc.name [JS-API8]SingleKvStore.DeleteString() + * @tc.desc Test Js Api SingleKvStore.DeleteString() testcase 101 + */ it('testSingleKvStoreDeleteString101', 0, async function (done) { console.log('testSingleKvStoreDeleteString101'); try { @@ -472,6 +567,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETESTRING_1020 + * @tc.name [JS-API8]SingleKvStore.DeleteString() + * @tc.desc Test Js Api SingleKvStore.DeleteString() testcase 102 + */ it('testSingleKvStoreDeleteString102', 0, async function (done) { console.log('testSingleKvStoreDeleteString102'); try { @@ -491,6 +591,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEINT_1010 + * @tc.name [JS-API8]SingleKvStore.DeleteInt() + * @tc.desc Test Js Api SingleKvStore.DeleteInt() testcase 101 + */ it('testSingleKvStoreDeleteInt101', 0, async function (done) { console.log('testSingleKvStoreDeleteInt101'); try{ @@ -510,6 +615,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEINT_1020 + * @tc.name [JS-API8]SingleKvStore.DeleteInt() + * @tc.desc Test Js Api SingleKvStore.DeleteInt() testcase 102 + */ it('testSingleKvStoreDeleteInt102', 0, async function (done) { console.log('testSingleKvStoreDeleteInt102'); try{ @@ -529,6 +639,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEFLOAT_1010 + * @tc.name [JS-API8]SingleKvStore.DeleteFloat() + * @tc.desc Test Js Api SingleKvStore.DeleteFloat() testcase 101 + */ it('testSingleKvStoreDeleteFloat101', 0, async function (done) { console.log('testSingleKvStoreDeleteFloat101'); try{ @@ -548,6 +663,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEFLOAT_1020 + * @tc.name [JS-API8]SingleKvStore.DeleteFloat() + * @tc.desc Test Js Api SingleKvStore.DeleteFloat() testcase 102 + */ it('testSingleKvStoreDeleteFloat102', 0, async function (done) { console.log('testSingleKvStoreDeleteFloat102'); try{ @@ -567,6 +687,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBOOL_1010 + * @tc.name [JS-API8]SingleKvStore.DeleteBool() + * @tc.desc Test Js Api SingleKvStore.DeleteBool() testcase 101 + */ it('testSingleKvStoreDeleteBool101', 0, async function (done) { console.log('testSingleKvStoreDeleteBool101'); try{ @@ -586,6 +711,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBOOL_1020 + * @tc.name [JS-API8]SingleKvStore.DeleteBool() + * @tc.desc Test Js Api SingleKvStore.DeleteBool() testcase 102 + */ it('testSingleKvStoreDeleteBool102', 0, async function (done) { console.log('testSingleKvStoreDeleteBool102'); try{ @@ -605,6 +735,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONCHANGE_1010 + * @tc.name [JS-API8]SingleKvStore.OnChange() + * @tc.desc Test Js Api SingleKvStore.OnChange() testcase 101 + */ it('testSingleKvStoreOnChange101', 0, async function (done) { console.log('testSingleKvStoreOnChange101'); try { @@ -624,6 +759,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONCHANGE_1020 + * @tc.name [JS-API8]SingleKvStore.OnChange() + * @tc.desc Test Js Api SingleKvStore.OnChange() testcase 102 + */ it('testSingleKvStoreOnChange102', 0, async function (done) { console.log('testSingleKvStoreOnChange102'); try { @@ -643,6 +783,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONCHANGE_1030 + * @tc.name [JS-API8]SingleKvStore.OnChange() + * @tc.desc Test Js Api SingleKvStore.OnChange() testcase 103 + */ it('testSingleKvStoreOnChange103', 0, async function (done) { console.log('testSingleKvStoreOnChange103'); try { @@ -662,6 +807,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONSYNCCOMPLETE_1010 + * @tc.name [JS-API8]SingleKvStore.OnSyncComplete() + * @tc.desc Test Js Api SingleKvStore.OnSyncComplete() testcase 101 + */ it('testSingleKvStoreOnSyncComplete101', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -683,6 +833,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONSYNCCOMPLETE_1020 + * @tc.name [JS-API8]SingleKvStore.OnSyncComplete() + * @tc.desc Test Js Api SingleKvStore.OnSyncComplete() testcase 102 + */ it('testSingleKvStoreOnSyncComplete102', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -704,6 +859,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONSYNCCOMPLETE_1030 + * @tc.name [JS-API8]SingleKvStore.OnSyncComplete() + * @tc.desc Test Js Api SingleKvStore.OnSyncComplete() testcase 103 + */ it('testSingleKvStoreOnSyncComplete103', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -725,6 +885,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCRANGE_1010 + * @tc.name [JS-API8]SingleKvStore.SetSyncRange() + * @tc.desc Test Js Api SingleKvStore.SetSyncRange() testcase 101 + */ it('testSingleKvStoreSetSyncRange101', 0, async function (done) { console.log('testSingleKvStoreSetSyncRange101'); try { @@ -742,6 +907,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCRANGE_1020 + * @tc.name [JS-API8]SingleKvStore.SetSyncRange() + * @tc.desc Test Js Api SingleKvStore.SetSyncRange() testcase 102 + */ it('testSingleKvStoreSetSyncRange102', 0, async function (done) { console.log('testSingleKvStoreSetSyncRange102'); try { @@ -759,6 +929,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCRANGE_1030 + * @tc.name [JS-API8]SingleKvStore.SetSyncRange() + * @tc.desc Test Js Api SingleKvStore.SetSyncRange() testcase 103 + */ it('testSingleKvStoreSetSyncRange103', 0, async function (done) { console.log('testSingleKvStoreSetSyncRange103'); try { @@ -776,6 +951,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_1010 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 101 + */ it('testSingleKvStorePutBatch101', 0, async function (done) { console.log('testSingleKvStorePutBatch101'); try { @@ -811,6 +991,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_1020 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 102 + */ it('testSingleKvStorePutBatch102', 0, async function (done) { console.log('testSingleKvStorePutBatch102'); try { @@ -846,6 +1031,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_1030 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 103 + */ it('testSingleKvStorePutBatch103', 0, async function (done) { console.log('testSingleKvStorePutBatch103'); try { @@ -881,6 +1071,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_1040 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 104 + */ it('testSingleKvStorePutBatch104', 0, async function (done) { console.log('testSingleKvStorePutBatch104'); try { @@ -916,6 +1111,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_1050 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 105 + */ it('testSingleKvStorePutBatch105', 0, async function (done) { console.log('testSingleKvStorePutBatch105'); try { @@ -952,6 +1152,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_1060 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 106 + */ it('testSingleKvStorePutBatch106', 0, async function (done) { console.log('testSingleKvStorePutBatch106'); try { @@ -988,6 +1193,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBATCH_1010 + * @tc.name [JS-API8]SingleKvStore.DeleteBatch() + * @tc.desc Test Js Api SingleKvStore.DeleteBatch() testcase 101 + */ it('testSingleKvStoreDeleteBatch101', 0, async function (done) { console.log('testSingleKvStoreDeleteBatch101'); try { @@ -1022,6 +1232,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBATCH_1020 + * @tc.name [JS-API8]SingleKvStore.DeleteBatch() + * @tc.desc Test Js Api SingleKvStore.DeleteBatch() testcase 102 + */ it('testSingleKvStoreDeleteBatch102', 0, async function (done) { console.log('testSingleKvStoreDeleteBatch102'); try { @@ -1038,6 +1253,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBATCH_1030 + * @tc.name [JS-API8]SingleKvStore.DeleteBatch() + * @tc.desc Test Js Api SingleKvStore.DeleteBatch() testcase 103 + */ it('testSingleKvStoreDeleteBatch103', 0, async function (done) { console.log('testSingleKvStoreDeleteBatch103'); try { @@ -1071,16 +1291,19 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_1010 + * @tc.name [JS-API8]SingleKvStore.startTransaction() + * @tc.desc Test Js Api SingleKvStore.startTransaction() testcase 101 + */ it('testSingleKvStorestartTransaction101', 0, async function (done) { console.log('testSingleKvStorestartTransaction101'); try { - // register dataChange callback var count = 0; kvStore.on('dataChange', 0, function (data) { console.log('testSingleKvStorestartTransaction101 0' + data) count++; }); - // startTransaction await kvStore.startTransaction(async function (err,data) { console.log('testSingleKvStorestartTransaction101 startTransaction success'); expect(err == undefined).assertTrue(); @@ -1093,12 +1316,10 @@ describe('SingleKvStoreCallbackTest', function () { await kvStore.deleteBatch(keys, async function (err,data) { console.log('testSingleKvStorestartTransaction101 deleteBatch success'); expect(err == undefined).assertTrue(); - // commit await kvStore.commit(async function (err,data) { console.log('testSingleKvStorestartTransaction101 commit success'); expect(err == undefined).assertTrue(); await sleep(2000); - // assert expect(count == 1).assertTrue(); done(); }); @@ -1112,10 +1333,14 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_1020 + * @tc.name [JS-API8]SingleKvStore.startTransaction() + * @tc.desc Test Js Api SingleKvStore.startTransaction() testcase 102 + */ it('testSingleKvStorestartTransaction102', 0, async function (done) { console.log('testSingleKvStorestartTransaction102'); try { - // register dataChange callback var count = 0; kvStore.on('dataChange', 0, function (data) { console.log('testSingleKvStorestartTransaction102 0' + data) @@ -1133,12 +1358,10 @@ describe('SingleKvStoreCallbackTest', function () { await kvStore.deleteBatch(keys, async function (err,data) { console.log('testSingleKvStorestartTransaction102 deleteBatch success'); expect(err == undefined).assertTrue(); - // rollback await kvStore.rollback(async function (err,data) { console.log('testSingleKvStorestartTransaction102 rollback success'); expect(err == undefined).assertTrue(); await sleep(2000); - // assert expect(count == 0).assertTrue(); done(); }); @@ -1152,6 +1375,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_1030 + * @tc.name [JS-API8]SingleKvStore.startTransaction() + * @tc.desc Test Js Api SingleKvStore.startTransaction() testcase 103 + */ it('testSingleKvStorestartTransaction103', 0, async function (done) { console.log('testSingleKvStorestartTransaction103'); try { @@ -1170,6 +1398,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_1040 + * @tc.name [JS-API8]SingleKvStore.startTransaction() + * @tc.desc Test Js Api SingleKvStore.startTransaction() testcase 104 + */ it('testSingleKvStorestartTransaction104', 0, async function (done) { console.log('testSingleKvStorestartTransaction104'); try { @@ -1188,6 +1421,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_1050 + * @tc.name [JS-API8]SingleKvStore.startTransaction() + * @tc.desc Test Js Api SingleKvStore.startTransaction() testcase 105 + */ it('testSingleKvStorestartTransaction105', 0, async function (done) { console.log('testSingleKvStorestartTransaction105'); try { @@ -1206,6 +1444,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_COMMIT_1010 + * @tc.name [JS-API8]SingleKvStore.Commit() + * @tc.desc Test Js Api SingleKvStore.Commit() testcase 101 + */ it('testSingleKvStoreCommit101', 0, async function (done) { console.log('testSingleKvStoreCommit101'); try { @@ -1224,6 +1467,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_COMMIT_1020 + * @tc.name [JS-API8]SingleKvStore.Commit() + * @tc.desc Test Js Api SingleKvStore.Commit() testcase 102 + */ it('testSingleKvStoreCommit102', 0, async function (done) { console.log('testSingleKvStoreCommit102'); try { @@ -1242,6 +1490,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_COMMIT_1030 + * @tc.name [JS-API8]SingleKvStore.Commit() + * @tc.desc Test Js Api SingleKvStore.Commit() testcase 103 + */ it('testSingleKvStoreCommit103', 0, async function (done) { console.log('testSingleKvStoreCommit103'); try { @@ -1260,6 +1513,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ROLLBACK_1010 + * @tc.name [JS-API8]SingleKvStore.Rollback() + * @tc.desc Test Js Api SingleKvStore.Rollback() testcase 101 + */ it('testSingleKvStoreRollback101', 0, async function (done) { console.log('testSingleKvStoreRollback101'); try { @@ -1278,6 +1536,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ROLLBACK_1020 + * @tc.name [JS-API8]SingleKvStore.Rollback() + * @tc.desc Test Js Api SingleKvStore.Rollback() testcase 102 + */ it('testSingleKvStoreRollback102', 0, async function (done) { console.log('testSingleKvStoreRollback102'); try { @@ -1296,6 +1559,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ROLLBACK_1030 + * @tc.name [JS-API8]SingleKvStore.Rollback() + * @tc.desc Test Js Api SingleKvStore.Rollback() testcase 103 + */ it('testSingleKvStoreRollback103', 0, async function (done) { console.log('testSingleKvStoreRollback103'); try { @@ -1314,6 +1582,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_1010 + * @tc.name [JS-API8]SingleKvStore.EnableSync() + * @tc.desc Test Js Api SingleKvStore.EnableSync() testcase 101 + */ it('testSingleKvStoreEnableSync101', 0, async function (done) { console.log('testSingleKvStoreEnableSync101'); try { @@ -1334,6 +1607,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_1020 + * @tc.name [JS-API8]SingleKvStore.EnableSync() + * @tc.desc Test Js Api SingleKvStore.EnableSync() testcase 102 + */ it('testSingleKvStoreEnableSync102', 0, async function (done) { console.log('testSingleKvStoreEnableSync102'); try { @@ -1354,6 +1632,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_1030 + * @tc.name [JS-API8]SingleKvStore.EnableSync() + * @tc.desc Test Js Api SingleKvStore.EnableSync() testcase 103 + */ it('testSingleKvStoreEnableSync103', 0, async function (done) { console.log('testSingleKvStoreEnableSync103'); try { @@ -1372,6 +1655,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_1040 + * @tc.name [JS-API8]SingleKvStore.EnableSync() + * @tc.desc Test Js Api SingleKvStore.EnableSync() testcase 104 + */ it('testSingleKvStoreEnableSync104', 0, async function (done) { console.log('testSingleKvStoreEnableSync104'); try { @@ -1390,6 +1678,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_1010 + * @tc.name [JS-API8]SingleKvStore.RemoveDeviceData() + * @tc.desc Test Js Api SingleKvStore.RemoveDeviceData() testcase 101 + */ it('testSingleKvStoreRemoveDeviceData101', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData101'); try { @@ -1419,6 +1712,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_1020 + * @tc.name [JS-API8]SingleKvStore.RemoveDeviceData() + * @tc.desc Test Js Api SingleKvStore.RemoveDeviceData() testcase 102 + */ it('testSingleKvStoreRemoveDeviceData102', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData102'); try { @@ -1437,6 +1735,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_1030 + * @tc.name [JS-API8]SingleKvStore.RemoveDeviceData() + * @tc.desc Test Js Api SingleKvStore.RemoveDeviceData() testcase 103 + */ it('testSingleKvStoreRemoveDeviceData103', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData103'); try { @@ -1455,6 +1758,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_1040 + * @tc.name [JS-API8]SingleKvStore.RemoveDeviceData() + * @tc.desc Test Js Api SingleKvStore.RemoveDeviceData() testcase 104 + */ it('testSingleKvStoreRemoveDeviceData104', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData104'); try { @@ -1473,6 +1781,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_1010 + * @tc.name [JS-API8]SingleKvStore.SetSyncParam() + * @tc.desc Test Js Api SingleKvStore.SetSyncParam() testcase 101 + */ it('testSingleKvStoreSetSyncParam101', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam101'); try { @@ -1489,6 +1802,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_1020 + * @tc.name [JS-API8]SingleKvStore.SetSyncParam() + * @tc.desc Test Js Api SingleKvStore.SetSyncParam() testcase 102 + */ it('testSingleKvStoreSetSyncParam102', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam102'); try { @@ -1507,6 +1825,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_1030 + * @tc.name [JS-API8]SingleKvStore.SetSyncParam() + * @tc.desc Test Js Api SingleKvStore.SetSyncParam() testcase 103 + */ it('testSingleKvStoreSetSyncParam103', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam103'); try { @@ -1525,6 +1848,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_1040 + * @tc.name [JS-API8]SingleKvStore.SetSyncParam() + * @tc.desc Test Js Api SingleKvStore.SetSyncParam() testcase 104 + */ it('testSingleKvStoreSetSyncParam104', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam104'); try { @@ -1543,6 +1871,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_1010 + * @tc.name [JS-API8]SingleKvStore.GetSecurityLevel() + * @tc.desc Test Js Api SingleKvStore.GetSecurityLevel() testcase 101 + */ it('testSingleKvStoreGetSecurityLevel101', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel101'); try { @@ -1558,6 +1891,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_1020 + * @tc.name [JS-API8]SingleKvStore.GetSecurityLevel() + * @tc.desc Test Js Api SingleKvStore.GetSecurityLevel() testcase 102 + */ it('testSingleKvStoreGetSecurityLevel102', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel102'); try { @@ -1577,6 +1915,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_1030 + * @tc.name [JS-API8]SingleKvStore.GetSecurityLevel() + * @tc.desc Test Js Api SingleKvStore.GetSecurityLevel() testcase 103 + */ it('testSingleKvStoreGetSecurityLevel103', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel103'); try { @@ -1596,6 +1939,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_1040 + * @tc.name [JS-API8]SingleKvStore.GetSecurityLevel() + * @tc.desc Test Js Api SingleKvStore.GetSecurityLevel() testcase 104 + */ it('testSingleKvStoreGetSecurityLevel104', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel104'); try { @@ -1615,6 +1963,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_1010 + * @tc.name [JS-API8]SingleKvStore.GetResultSet() + * @tc.desc Test Js Api SingleKvStore.GetResultSet() testcase 101 + */ it('testSingleKvStoreGetResultSet101', 0, async function (done) { console.log('testSingleKvStoreGetResultSet101'); try { @@ -1652,6 +2005,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_1020 + * @tc.name [JS-API8]SingleKvStore.GetResultSet() + * @tc.desc Test Js Api SingleKvStore.GetResultSet() testcase 102 + */ it('testSingleKvStoreGetResultSet102', 0, async function (done) { console.log('testSingleKvStoreGetResultSet102'); try { @@ -1673,6 +2031,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_1030 + * @tc.name [JS-API8]SingleKvStore.GetResultSet() + * @tc.desc Test Js Api SingleKvStore.GetResultSet() testcase 103 + */ it('testSingleKvStoreGetResultSet103', 0, async function (done) { console.log('testSingleKvStoreGetResultSet103'); try { @@ -1689,6 +2052,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_1040 + * @tc.name [JS-API8]SingleKvStore.GetResultSet() + * @tc.desc Test Js Api SingleKvStore.GetResultSet() testcase 104 + */ it('testSingleKvStoreGetResultSet104', 0, async function (done) { console.log('testSingleKvStoreGetResultSet104'); try { @@ -1705,6 +2073,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_1050 + * @tc.name [JS-API8]SingleKvStore.GetResultSet() + * @tc.desc Test Js Api SingleKvStore.GetResultSet() testcase 105 + */ it('testSingleKvStoreGetResultSet105', 0, async function (done) { console.log('testSingleKvStoreGetResultSet105'); try { @@ -1744,6 +2117,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_1060 + * @tc.name [JS-API8]SingleKvStore.GetResultSet() + * @tc.desc Test Js Api SingleKvStore.GetResultSet() testcase 106 + */ it('testSingleKvStoreGetResultSet106', 0, async function (done) { console.log('testSingleKvStoreGetResultSet106'); try { @@ -1783,6 +2161,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_1010 + * @tc.name [JS-API8]SingleKvStore.CloseResultSet() + * @tc.desc Test Js Api SingleKvStore.CloseResultSet() testcase 101 + */ it('testSingleKvStoreCloseResultSet101', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet101'); try { @@ -1804,6 +2187,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_1020 + * @tc.name [JS-API8]SingleKvStore.CloseResultSet() + * @tc.desc Test Js Api SingleKvStore.CloseResultSet() testcase 102 + */ it('testSingleKvStoreCloseResultSet102', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet102'); try { @@ -1829,6 +2217,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_1030 + * @tc.name [JS-API8]SingleKvStore.CloseResultSet() + * @tc.desc Test Js Api SingleKvStore.CloseResultSet() testcase 103 + */ it('testSingleKvStoreCloseResultSet103', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet103'); try { @@ -1849,10 +2242,14 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_1040 + * @tc.name [JS-API8]SingleKvStore.CloseResultSet() + * @tc.desc Test Js Api SingleKvStore.CloseResultSet() testcase 104 + */ it('testSingleKvStoreCloseResultSet104', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet104'); try { - // pass query console.log('testSingleKvStoreCloseResultSet104 success'); }catch(e) { console.log('testSingleKvStoreCloseResultSet104 e ' + e); @@ -1861,6 +2258,11 @@ describe('SingleKvStoreCallbackTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSIZE_1010 + * @tc.name [JS-API8]SingleKvStore.GetResultSize() + * @tc.desc Test Js Api SingleKvStore.GetResultSize() testcase 101 + */ it('testSingleKvStoreGetResultSize101', 0, async function (done) { console.log('testSingleKvStoreGetResultSize101'); try { @@ -1894,6 +2296,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSIZE_1020 + * @tc.name [JS-API8]SingleKvStore.GetResultSize() + * @tc.desc Test Js Api SingleKvStore.GetResultSize() testcase 102 + */ it('testSingleKvStoreGetResultSize102', 0, async function (done) { console.log('testSingleKvStoreGetResultSize102'); try { @@ -1927,6 +2334,11 @@ describe('SingleKvStoreCallbackTest', function () { } }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETENTRIES_1010 + * @tc.name [JS-API8]SingleKvStore.GetEntries() + * @tc.desc Test Js Api SingleKvStore.GetEntries() testcase 101 + */ it('testSingleKvStoreGetEntries101', 0, async function (done) { console.log('testSingleKvStoreGetEntries101'); try { @@ -1966,6 +2378,11 @@ describe('SingleKvStoreCallbackTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETENTRIES_1020 + * @tc.name [JS-API8]SingleKvStore.GetEntries() + * @tc.desc Test Js Api SingleKvStore.GetEntries() testcase 102 + */ it('testSingleKvStoreGetEntries102', 0, async function (done) { console.log('testSingleKvStoreGetEntries102'); try { diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreEnumJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreEnumJsunit.test.js index 535f6803a..35245a307 100644 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreEnumJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreEnumJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,169 +16,329 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' import factory from '@ohos.data.distributedData'; describe('KvStoreEnumTest', function () { - it('enumUsertypeTestSameUserId', 0, function () { + + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_USERTYPE_SAMEUSERID_0100 + * @tc.name [JS-API8]Usertype.SAME_USER_ID + * @tc.desc Test Js Enum Value Usertype.SAME_USER_ID + */ + it('testUsertypeSameUserId_001', 0, function () { var sameUserId = factory.UserType.SAME_USER_ID; console.info('sameUserId = ' + sameUserId); expect(sameUserId == 0).assertTrue() }) - it('enumConstantsTestMaxKeyLength', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXKEYLENGTH_0100 + * @tc.name [JS-API8]Constants.MAX_KEY_LENGTH + * @tc.desc Test Js Enum Value Constants.MAX_KEY_LENGTH + */ + it('testConstantsMaxKeyLength_001', 0, function () { var maxKeyLength = factory.Constants.MAX_KEY_LENGTH; console.info('maxKeyLength = ' + maxKeyLength); expect(maxKeyLength == 1024).assertTrue() }) - it('enumConstantsTestMaxValueLength', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXVALUELENGTH_0100 + * @tc.name [JS-API8]Constants.MAX_VALUE_LENGTH + * @tc.desc Test Js Enum Value Constants.MAX_VALUE_LENGTH + */ + it('testConstantsMaxValueLength_001', 0, function () { var maxValueLength = factory.Constants.MAX_VALUE_LENGTH; console.info('maxValueLength = ' + maxValueLength); - expect(maxValueLength == 4194303).assertTrue() + expect(maxValueLength == 4194303).assertTrue(); + expect( factory.Constants.MAX_VALUE_LENGTH).assertEqual(4194303); + }) + + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXVALUELENGTH_0200 + * @tc.name [JS-API8]Constants.MAX_VALUE_LENGTH + * @tc.desc Test Js Enum Value Constants.MAX_VALUE_LENGTH + */ + it('testConstantsMaxValueLength_002', 0, function () { + try { + factory.Constants.MAX_VALUE_LENGTH = 123; + } catch (e) { + console.info('can NOT set value to MAX_VALUE_LENGTH : ' + e); + expect(factory.Constants.MAX_VALUE_LENGTH).assertEqual(4194303); + } + }) - it('enumConstantsTestMaxKeyLengthDevice', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXKEYLENGTHDEVICE_0100 + * @tc.name [JS-API8]Constants.MAX_KEY_LENGTH_DEVICE + * @tc.desc Test Js Enum Value Constants.MAX_KEY_LENGTH_DEVICE + */ + it('testConstantsMaxKeyLengthDevice_001', 0, function () { + + expect( factory.Constants.MAX_VALUE_LENGTH).assertEqual(4194303); + var maxKeyLengthDevice = factory.Constants.MAX_KEY_LENGTH_DEVICE; console.info('maxKeyLengthDevice = ' + maxKeyLengthDevice); expect(maxKeyLengthDevice == 896).assertTrue() }) - it('enumConstantsTestMaxStoreIdLength', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXSTOREIDLENGTH_0100 + * @tc.name [JS-API8]Constants.MAX_STORE_ID_LENGTH + * @tc.desc Test Js Enum Value Constants.MAX_STORE_ID_LENGTH + */ + it('testConstantsMaxStoreIdLength_001', 0, function () { var maxStoreIdLength = factory.Constants.MAX_STORE_ID_LENGTH; console.info('maxStoreIdLength = ' + maxStoreIdLength); expect(maxStoreIdLength == 128).assertTrue() }) - it('enumConstantsTestMaxQueryLength', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXQUERYLENGTH_0100 + * @tc.name [JS-API8]Constants.MAX_QUERY_LENGTH + * @tc.desc Test Js Enum Value Constants.MAX_QUERY_LENGTH + */ + it('testConstantsMaxQueryLength_001', 0, function () { var maxQueryLength = factory.Constants.MAX_QUERY_LENGTH; console.info('maxQueryLength = ' + maxQueryLength); expect(maxQueryLength == 512000).assertTrue() }) - it('enumConstantsTestMaxBatchSize', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_CONSTANTS_MAXBATCHSIZE_0100 + * @tc.name [JS-API8]Constants.MAX_BATCH_SIZE + * @tc.desc Test Js Enum Value Constants.MAX_BATCH_SIZE + */ + it('testConstantsMaxBatchSize_001', 0, function () { var maxBatchSize = factory.Constants.MAX_BATCH_SIZE; console.info('maxBatchSize = ' + maxBatchSize); expect(maxBatchSize == 128).assertTrue() }) - it('enumValuetypeTestString', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_VALUETYPE_STRING_0100 + * @tc.name [JS-API8]Valuetype.STRING + * @tc.desc Test Js Enum Value Valuetype.STRING + */ + it('testValuetypeString_001', 0, function () { var string = factory.ValueType.STRING; console.info('string = ' + string); expect(string == 0).assertTrue() }) - it('enumValuetypeTestInteger', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_VALUETYPE_INTEGER_0100 + * @tc.name [JS-API8]Valuetype.INTEGER + * @tc.desc Test Js Enum Value Valuetype.INTEGER + */ + it('testValuetypeInteger_001', 0, function () { var integer = factory.ValueType.INTEGER; console.info('integer = ' + integer); expect(integer == 1).assertTrue() }) - it('enumValuetypeTestFloat', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_VALUETYPE_FLOAT_0100 + * @tc.name [JS-API8]Valuetype.FLOAT + * @tc.desc Test Js Enum Value Valuetype.FLOAT + */ + it('testValuetypeFloat_001', 0, function () { var float = factory.ValueType.FLOAT; console.info('float = ' + float); expect(float == 2).assertTrue() }) - it('enumValuetypeTestByteArray', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_VALUETYPE_BYTEARRAY_0100 + * @tc.name [JS-API8]Valuetype.BYTEARRAY + * @tc.desc Test Js Enum Value Valuetype.BYTEARRAY + */ + it('testValuetypeByteArray_001', 0, function () { var byteArray = factory.ValueType.BYTE_ARRAY; console.info('byteArray = ' + byteArray); expect(byteArray == 3).assertTrue() }) - it('enumValuetypeTestBoolean', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_VALUETYPE_BOOLEAN_0100 + * @tc.name [JS-API8]Valuetype.BOOLEAN + * @tc.desc Test Js Enum Value Valuetype.BOOLEAN + */ + it('testValuetypeBoolean_001', 0, function () { var boolean = factory.ValueType.BOOLEAN; console.info('boolean = ' + boolean); expect(boolean == 4).assertTrue() }) - it('enumValuetypeTestDouble', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_VALUETYPE_DOUBLE_0100 + * @tc.name [JS-API8]Valuetype.DOUBLE + * @tc.desc Test Js Enum Value Valuetype.DOUBLE + */ + it('testValuetypeDouble_001', 0, function () { var double = factory.ValueType.DOUBLE; console.info('double = ' + double); expect(double == 5).assertTrue() }) - it('enumSyncmodeTestPullOnly', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SYNCMODE_PULLONLY_0100 + * @tc.name [JS-API8]Syncmode.PULL_ONLY + * @tc.desc Test Js Enum Value Syncmode.PULL_ONLY + */ + it('testSyncmodePullOnly_001', 0, function () { var pullonly = factory.SyncMode.PULL_ONLY; console.info('pullonly = ' + pullonly); expect(pullonly == 0).assertTrue() }) - it('enumSyncmodeTestPushOnly', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SYNCMODE_PUSHONLY_0100 + * @tc.name [JS-API8]Syncmode.PUSH_ONLY + * @tc.desc Test Js Enum Value Syncmode.PUSH_ONLY + */ + it('testSyncmodePushOnly_001', 0, function () { var pushonly = factory.SyncMode.PUSH_ONLY; console.info('pushonly = ' + pushonly); expect(pushonly == 1).assertTrue() }) - it('enumSyncmodeTestPushPull', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SYNCMODE_PUSHPULL_0100 + * @tc.name [JS-API8]Syncmode.PUSH_PULL + * @tc.desc Test Js Enum Value Syncmode.PUSH_PULL + */ + it('testSyncmodePushPull_001', 0, function () { var pushpull = factory.SyncMode.PUSH_PULL; console.info('pushpull = ' + pushpull); expect(pushpull == 2).assertTrue() }) - it('enumSubscribetypeTestSubscribeTypeLocal', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SUBSCRIBETYPE_LOCAL_0100 + * @tc.name [JS-API8]Subscribetype.SUBSCRIBE_TYPE_LOCAL + * @tc.desc Test Js Enum Value Subscribetype.SUBSCRIBE_TYPE_LOCAL + */ + it('testSubscribetypeSubscribeTypeLocal_001', 0, function () { var local = factory.SubscribeType.SUBSCRIBE_TYPE_LOCAL; console.info('local = ' + local); expect(local == 0).assertTrue() }) - it('enumSubscribetypeTestSubscribeTypeRemote', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SUBSCRIBETYPE_REMOTE_0100 + * @tc.name [JS-API8]Subscribetype.SUBSCRIBE_TYPE_REMOTE + * @tc.desc Test Js Enum Value Subscribetype.SUBSCRIBE_TYPE_REMOTE + */ + it('testSubscribetypeSubscribeTypeRemote_001', 0, function () { var remote = factory.SubscribeType.SUBSCRIBE_TYPE_REMOTE; console.info('remote = ' + remote); expect(remote == 1).assertTrue() }) - it('enumSubscribetypeTestSubscribeTypeAll', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SUBSCRIBETYPE_ALL_0100 + * @tc.name [JS-API8]Subscribetype.SUBSCRIBE_TYPE_ALL + * @tc.desc Test Js Enum Value Subscribetype.SUBSCRIBE_TYPE_ALL + */ + it('testSubscribetypeSubscribeTypeAll_001', 0, function () { var all = factory.SubscribeType.SUBSCRIBE_TYPE_ALL; console.info('all = ' + all); expect(all == 2).assertTrue() }) - it('enumKvstoretypeTestDeviceCollaboration', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORETYPE_DEVICECOLLABORATION_0100 + * @tc.name [JS-API8]Kvstoretype.DEVICE_COLLABORATION + * @tc.desc Test Js Enum Value Kvstoretype.DEVICE_COLLABORATION + */ + it('testKvstoretypeDeviceCollaboration_001', 0, function () { var collaboration = factory.KVStoreType.DEVICE_COLLABORATION; console.info('collaboration = ' + collaboration); expect(collaboration == 0).assertTrue() }) - it('enumKvstoretypeTestSingleVersion', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORETYPE_SINGLEVERSION_0100 + * @tc.name [JS-API8]Kvstoretype.SINGLE_VERSION + * @tc.desc Test Js Enum Value Kvstoretype.SINGLE_VERSION + */ + it('testKvstoretypeSingleVersion_001', 0, function () { var single = factory.KVStoreType.SINGLE_VERSION; console.info('single = ' + single); expect(single == 1).assertTrue() }) - it('enumKvstoretypeTestMultiVersion', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORETYPE_MULTIVERSION_0100 + * @tc.name [JS-API8]Kvstoretype.MULTI_VERSION + * @tc.desc Test Js Enum Value Kvstoretype.MULTI_VERSION + */ + it('testKvstoretypeMultiVersion_001', 0, function () { var multi = factory.KVStoreType.MULTI_VERSION; console.info('multi = ' + multi); expect(multi == 2).assertTrue() }) - it('enumSecuritylevelTestNoLevel', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SECURITYLEVEL_NOLEVEL_0100 + * @tc.name [JS-API8]Securitylevel.NO_LEVEL + * @tc.desc Test Js Enum Value Securitylevel.NO_LEVEL + */ + it('testSecuritylevelNoLevel_001', 0, function () { var nolevel = factory.SecurityLevel.NO_LEVEL; console.info('nolevel = ' + nolevel); expect(nolevel == 0).assertTrue() }) - it('enumSecuritylevelTestS0', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SECURITYLEVEL_S0_0100 + * @tc.name [JS-API8]Securitylevel.S0 + * @tc.desc Test Js Enum Value Securitylevel.S0 + */ + it('testSecuritylevelS0_001', 0, function () { var s0 = factory.SecurityLevel.S0; console.info('s0 = ' + s0); expect(s0 == 1).assertTrue() }) - it('enumSecuritylevelTestS1', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SECURITYLEVEL_S1_0100 + * @tc.name [JS-API8]Securitylevel.S1 + * @tc.desc Test Js Enum Value Securitylevel.S1 + */ + it('testSecuritylevelS1_001', 0, function () { var s1 = factory.SecurityLevel.S1; console.info('s1 = ' + s1); expect(s1 == 2).assertTrue() }) - it('enumSecuritylevelTestS2', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SECURITYLEVEL_S2_0100 + * @tc.name [JS-API8]Securitylevel.S2 + * @tc.desc Test Js Enum Value Securitylevel.S2 + */ + it('testSecuritylevelS2_001', 0, function () { var s2 = factory.SecurityLevel.S2; console.info('s2 = ' + s2); expect(s2 == 3).assertTrue() }) - it('enumSecuritylevelTestS3', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SECURITYLEVEL_S3_0100 + * @tc.name [JS-API8]Securitylevel.S3 + * @tc.desc Test Js Enum Value Securitylevel.S3 + */ + it('testSecuritylevelS3_001', 0, function () { var s3 = factory.SecurityLevel.S3; console.info('s3 = ' + s3); expect(s3 == 5).assertTrue() }) - it('enumSecuritylevelTestS4', 0, function () { + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SECURITYLEVEL_S4_0100 + * @tc.name [JS-API8]Securitylevel.S4 + * @tc.desc Test Js Enum Value Securitylevel.S4 + */ + it('testSecuritylevelS4_001', 0, function () { var s4 = factory.SecurityLevel.S4; console.info('s4 = ' + s4); expect(s4 == 6).assertTrue() diff --git a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js index 37a6e1c03..a1dd76880 100755 --- a/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js +++ b/distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -117,6 +117,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTSTRING_0100 + * @tc.name [JS-API8]SingleKvStore.Put(String) + * @tc.desc Test Js Api SingleKvStore.Put(String) testcase 001 + */ it('testSingleKvStorePutString001', 0, async function (done) { console.log('testSingleKvStorePutString001'); try { @@ -133,6 +138,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTSTRING_0200 + * @tc.name [JS-API8]SingleKvStore.Put(String) + * @tc.desc Test Js Api SingleKvStore.Put(String) testcase 002 + */ it('testSingleKvStorePutString002', 0, async function (done) { console.log('testSingleKvStorePutString002'); try { @@ -150,6 +160,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTSTRING_0300 + * @tc.name [JS-API8]SingleKvStore.Put(String) + * @tc.desc Test Js Api SingleKvStore.Put(String) testcase 003 + */ it('testSingleKvStorePutString003', 0, async function (done) { console.log('testSingleKvStorePutString003'); try { @@ -167,6 +182,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTSTRING_0400 + * @tc.name [JS-API8]SingleKvStore.Put(String) + * @tc.desc Test Js Api SingleKvStore.Put(String) testcase 004 + */ it('testSingleKvStorePutString004', 0, async function (done) { console.log('testSingleKvStorePutString004'); try { @@ -195,6 +215,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSTRING_0100 + * @tc.name [JS-API8]SingleKvStoreGetString. + * @tc.desc Test Js Api SingleKvStoreGetString testcase 001 + */ it('testSingleKvStoreGetString001', 0, async function (done) { console.log('testSingleKvStoreGetString001'); try { @@ -219,6 +244,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSTRING_0200 + * @tc.name [JS-API8]SingleKvStoreGetString. + * @tc.desc Test Js Api SingleKvStoreGetString testcase 002 + */ it('testSingleKvStoreGetString002', 0, async function (done) { console.log('testSingleKvStoreGetString002'); try { @@ -234,6 +264,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_0100 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 001 + */ it('testSingleKvStorePutInt001', 0, async function (done) { console.log('testSingleKvStorePutInt001'); try { @@ -251,6 +286,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_0200 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 002 + */ it('testSingleKvStorePutInt002', 0, async function (done) { console.log('testSingleKvStorePutInt002'); try { @@ -276,6 +316,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_0300 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 003 + */ it('testSingleKvStorePutInt003', 0, async function (done) { console.log('testSingleKvStorePutInt003'); try { @@ -301,6 +346,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTINT_0400 + * @tc.name [JS-API8]SingleKvStore.Put(Int) + * @tc.desc Test Js Api SingleKvStore.Put(Int) testcase 004 + */ it('testSingleKvStorePutInt004', 0, async function (done) { console.log('testSingleKvStorePutInt004'); try { @@ -326,6 +376,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETINT_0100 + * @tc.name [JS-API8]SingleKvStoreGetInt. + * @tc.desc Test Js Api SingleKvStoreGetInt testcase 001 + */ it('testSingleKvStoreGetInt001', 0, async function (done) { console.log('testSingleKvStoreGetInt001'); try { @@ -350,6 +405,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBOOL_0100 + * @tc.name [JS-API8]SingleKvStore.Put(Bool) + * @tc.desc Test Js Api SingleKvStore.Put(Bool) testcase 001 + */ it('testSingleKvStorePutBool001', 0, async function (done) { console.log('testSingleKvStorePutBool001'); try { @@ -367,6 +427,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETBOOL_0100 + * @tc.name [JS-API8]SingleKvStoreGetBool. + * @tc.desc Test Js Api SingleKvStoreGetBool testcase 001 + */ it('testSingleKvStoreGetBool001', 0, async function (done) { console.log('testSingleKvStoreGetBool001'); try { @@ -392,6 +457,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTFLOAT_0100 + * @tc.name [JS-API8]SingleKvStore.Put(Float) + * @tc.desc Test Js Api SingleKvStore.Put(Float) testcase 001 + */ it('testSingleKvStorePutFloat001', 0, async function (done) { console.log('testSingleKvStorePutFloat001'); try { @@ -409,6 +479,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETFLOAT_0100 + * @tc.name [JS-API8]SingleKvStoreGetFloat. + * @tc.desc Test Js Api SingleKvStoreGetFloat testcase 001 + */ it('testSingleKvStoreGetFloat001', 0, async function (done) { console.log('testSingleKvStoreGetFloat001'); try { @@ -434,6 +509,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETFLOAT_0200 + * @tc.name [JS-API8]SingleKvStoreGetFloat. + * @tc.desc Test Js Api SingleKvStoreGetFloat testcase 002 + */ it('testSingleKvStoreGetFloat002', 0, async function (done) { console.log('testSingleKvStoreGetFloat002'); try { @@ -459,6 +539,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETFLOAT_0300 + * @tc.name [JS-API8]SingleKvStoreGetFloat. + * @tc.desc Test Js Api SingleKvStoreGetFloat testcase 003 + */ it('testSingleKvStoreGetFloat003', 0, async function (done) { console.log('testSingleKvStoreGetFloat003'); try { @@ -484,6 +569,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETESTRING_0100 + * @tc.name [JS-API8]SingleKvStoreDeleteString. + * @tc.desc Test Js Api SingleKvStoreDeleteString testcase 001 + */ it('testSingleKvStoreDeleteString001', 0, async function (done) { console.log('testSingleKvStoreDeleteString001'); try { @@ -509,6 +599,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETESTRING_0200 + * @tc.name [JS-API8]SingleKvStoreDeleteString. + * @tc.desc Test Js Api SingleKvStoreDeleteString testcase 002 + */ it('testSingleKvStoreDeleteString002', 0, async function (done) { console.log('testSingleKvStoreDeleteString002'); try { @@ -537,6 +632,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETESTRING_0300 + * @tc.name [JS-API8]SingleKvStoreDeleteString. + * @tc.desc Test Js Api SingleKvStoreDeleteString testcase 003 + */ it('testSingleKvStoreDeleteString003', 0, async function (done) { console.log('testSingleKvStoreDeleteString003'); try { @@ -554,6 +654,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEINT_0100 + * @tc.name [JS-API8]SingleKvStoreDeleteInt. + * @tc.desc Test Js Api SingleKvStoreDeleteInt testcase 001 + */ it('testSingleKvStoreDeleteInt001', 0, async function (done) { console.log('testSingleKvStoreDeleteInt001'); try { @@ -578,6 +683,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEFLOAT_0100 + * @tc.name [JS-API8]SingleKvStoreDeleteFloat. + * @tc.desc Test Js Api SingleKvStoreDeleteFloat testcase 001 + */ it('testSingleKvStoreDeleteFloat001', 0, async function (done) { console.log('testSingleKvStoreDeleteFloat001'); try { @@ -602,6 +712,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBOOL_0100 + * @tc.name [JS-API8]SingleKvStoreDeleteBool. + * @tc.desc Test Js Api SingleKvStoreDeleteBool testcase 001 + */ it('testSingleKvStoreDeleteBool001', 0, async function (done) { console.log('testSingleKvStoreDeleteBool001'); try { @@ -626,6 +741,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONCHANGE_0100 + * @tc.name [JS-API8]SingleKvStoreOnChange. + * @tc.desc Test Js Api SingleKvStoreOnChange testcase 001 + */ it('testSingleKvStoreOnChange001', 0, async function (done) { try { kvStore.on('dataChange', 0, function (data) { @@ -646,6 +766,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONCHANGE_0200 + * @tc.name [JS-API8]SingleKvStoreOnChange. + * @tc.desc Test Js Api SingleKvStoreOnChange testcase 002 + */ it('testSingleKvStoreOnChange002', 0, async function (done) { try { kvStore.on('dataChange', 1, function (data) { @@ -666,6 +791,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONCHANGE_0300 + * @tc.name [JS-API8]SingleKvStoreOnChange. + * @tc.desc Test Js Api SingleKvStoreOnChange testcase 003 + */ it('testSingleKvStoreOnChange003', 0, async function (done) { try { kvStore.on('dataChange', 2, function (data) { @@ -686,6 +816,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONSYNCCOMPLETE_0100 + * @tc.name [JS-API8]SingleKvStoreOnSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOnSyncComplete testcase 001 + */ it('testSingleKvStoreOnSyncComplete001', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -709,6 +844,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONSYNCCOMPLETE_0200 + * @tc.name [JS-API8]SingleKvStoreOnSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOnSyncComplete testcase 002 + */ it('testSingleKvStoreOnSyncComplete002', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -732,6 +872,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ONSYNCCOMPLETE_0300 + * @tc.name [JS-API8]SingleKvStoreOnSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOnSyncComplete testcase 003 + */ it('testSingleKvStoreOnSyncComplete003', 0, async function (done) { try { kvStore.on('syncComplete', function (data) { @@ -755,6 +900,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFCHANGE_0100 + * @tc.name [JS-API8]SingleKvStoreOffChange. + * @tc.desc Test Js Api SingleKvStoreOffChange testcase 001 + */ it('testSingleKvStoreOffChange001', 0, async function (done) { console.log('testSingleKvStoreOffChange001'); try { @@ -770,6 +920,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFCHANGE_0200 + * @tc.name [JS-API8]SingleKvStoreOffChange. + * @tc.desc Test Js Api SingleKvStoreOffChange testcase 002 + */ it('testSingleKvStoreOffChange002', 0, async function (done) { console.log('testSingleKvStoreOffChange002'); try { @@ -789,6 +944,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFCHANGE_0300 + * @tc.name [JS-API8]SingleKvStoreOffChange. + * @tc.desc Test Js Api SingleKvStoreOffChange testcase 003 + */ it('testSingleKvStoreOffChange003', 0, async function (done) { console.log('testSingleKvStoreOffChange003'); try { @@ -809,6 +969,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFCHANGE_0400 + * @tc.name [JS-API8]SingleKvStoreOffChange. + * @tc.desc Test Js Api SingleKvStoreOffChange testcase 004 + */ it('testSingleKvStoreOffChange004', 0, async function (done) { console.log('testSingleKvStoreOffChange004'); try { @@ -824,6 +989,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFSYNCCOMPLETE_0100 + * @tc.name [JS-API8]SingleKvStoreOffSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOffSyncComplete testcase 001 + */ it('testSingleKvStoreOffSyncComplete001', 0, async function (done) { console.log('testSingleKvStoreOffSyncComplete001'); try { @@ -839,6 +1009,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFSYNCCOMPLETE_0200 + * @tc.name [JS-API8]SingleKvStoreOffSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOffSyncComplete testcase 002 + */ it('testSingleKvStoreOffSyncComplete002', 0, async function (done) { console.log('testSingleKvStoreOffSyncComplete002'); try { @@ -859,6 +1034,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFSYNCCOMPLETE_0300 + * @tc.name [JS-API8]SingleKvStoreOffSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOffSyncComplete testcase 003 + */ it('testSingleKvStoreOffSyncComplete003', 0, async function (done) { console.log('testSingleKvStoreOffSyncComplete003'); try { @@ -880,6 +1060,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_OFFSYNCCOMPLETE_0400 + * @tc.name [JS-API8]SingleKvStoreOffSyncComplete. + * @tc.desc Test Js Api SingleKvStoreOffSyncComplete testcase 004 + */ it('testSingleKvStoreOffSyncComplete004', 0, async function (done) { console.log('testSingleKvStoreOffSyncComplete004'); try { @@ -895,6 +1080,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCRANGE_0100 + * @tc.name [JS-API8]SingleKvStoreSetSyncRange. + * @tc.desc Test Js Api SingleKvStoreSetSyncRange testcase 001 + */ it('testSingleKvStoreSetSyncRange001', 0, async function (done) { console.log('testSingleKvStoreSetSyncRange001'); try { @@ -914,6 +1104,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCRANGE_0200 + * @tc.name [JS-API8]SingleKvStoreSetSyncRange. + * @tc.desc Test Js Api SingleKvStoreSetSyncRange testcase 002 + */ it('testSingleKvStoreSetSyncRange002', 0, async function (done) { console.log('testSingleKvStoreSetSyncRange002'); try { @@ -933,6 +1128,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCRANGE_0300 + * @tc.name [JS-API8]SingleKvStoreSetSyncRange. + * @tc.desc Test Js Api SingleKvStoreSetSyncRange testcase 003 + */ it('testSingleKvStoreSetSyncRange003', 0, async function (done) { console.log('testSingleKvStoreSetSyncRange003'); try { @@ -952,6 +1152,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_0100 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 001 + */ it('testSingleKvStorePutBatch001', 0, async function (done) { console.log('testSingleKvStorePutBatch001'); try { @@ -980,6 +1185,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_0200 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 002 + */ it('testSingleKvStorePutBatch002', 0, async function (done) { console.log('testSingleKvStorePutBatch002'); try { @@ -1018,6 +1228,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_0300 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 003 + */ it('testSingleKvStorePutBatch003', 0, async function (done) { console.log('testSingleKvStorePutBatch003'); try { @@ -1056,6 +1271,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_0400 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 004 + */ it('testSingleKvStorePutBatch004', 0, async function (done) { console.log('testSingleKvStorePutBatch004'); try { @@ -1094,6 +1314,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_0500 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 005 + */ it('testSingleKvStorePutBatch005', 0, async function (done) { console.log('testSingleKvStorePutBatch005'); try { @@ -1133,6 +1358,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_PUTBATCH_0600 + * @tc.name [JS-API8]SingleKvStore.PutBatch() + * @tc.desc Test Js Api SingleKvStore.PutBatch() testcase 006 + */ it('testSingleKvStorePutBatch006', 0, async function (done) { console.log('testSingleKvStorePutBatch006'); try { @@ -1172,6 +1402,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBATCH_0100 + * @tc.name [JS-API8]SingleKvStoreDeleteBatch. + * @tc.desc Test Js Api SingleKvStoreDeleteBatch testcase 001 + */ it('testSingleKvStoreDeleteBatch001', 0, async function (done) { console.log('testSingleKvStoreDeleteBatch001'); try { @@ -1211,6 +1446,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBATCH_0200 + * @tc.name [JS-API8]SingleKvStoreDeleteBatch. + * @tc.desc Test Js Api SingleKvStoreDeleteBatch testcase 002 + */ it('testSingleKvStoreDeleteBatch002', 0, async function (done) { console.log('testSingleKvStoreDeleteBatch002'); try { @@ -1228,6 +1468,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_DELETEBATCH_0300 + * @tc.name [JS-API8]SingleKvStoreDeleteBatch. + * @tc.desc Test Js Api SingleKvStoreDeleteBatch testcase 003 + */ it('testSingleKvStoreDeleteBatch003', 0, async function (done) { console.log('testSingleKvStoreDeleteBatch003'); try { @@ -1265,6 +1510,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_0100 + * @tc.name [JS-API8]SingleKvStorestartTransaction. + * @tc.desc Test Js Api SingleKvStorestartTransaction testcase 001 + */ it('testSingleKvStorestartTransaction001', 0, async function (done) { console.log('testSingleKvStorestartTransaction001'); try { @@ -1313,6 +1563,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_0200 + * @tc.name [JS-API8]SingleKvStorestartTransaction. + * @tc.desc Test Js Api SingleKvStorestartTransaction testcase 002 + */ it('testSingleKvStorestartTransaction002', 0, async function (done) { console.log('testSingleKvStorestartTransaction002'); try { @@ -1345,7 +1600,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStorestartTransaction002 deleteBatch fail ' + err); expect(null).assertFail(); }); - // rollback await kvStore.rollback().then(async (err) => { console.log('testSingleKvStorestartTransaction002 rollback success'); expect(err == undefined).assertTrue(); @@ -1362,6 +1616,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_0300 + * @tc.name [JS-API8]SingleKvStorestartTransaction. + * @tc.desc Test Js Api SingleKvStorestartTransaction testcase 003 + */ it('testSingleKvStorestartTransaction003', 0, async function (done) { console.log('testSingleKvStorestartTransaction002'); try { @@ -1377,6 +1636,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_0400 + * @tc.name [JS-API8]SingleKvStorestartTransaction. + * @tc.desc Test Js Api SingleKvStorestartTransaction testcase 004 + */ it('testSingleKvStorestartTransaction004', 0, async function (done) { console.log('testSingleKvStorestartTransaction004'); try { @@ -1392,6 +1656,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_STARTTRANSACTION_0500 + * @tc.name [JS-API8]SingleKvStorestartTransaction. + * @tc.desc Test Js Api SingleKvStorestartTransaction testcase 005 + */ it('testSingleKvStorestartTransaction005', 0, async function (done) { console.log('testSingleKvStorestartTransaction005'); try { @@ -1407,6 +1676,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_COMMIT_0100 + * @tc.name [JS-API8]SingleKvStoreCommit. + * @tc.desc Test Js Api SingleKvStoreCommit testcase 001 + */ it('testSingleKvStoreCommit001', 0, async function (done) { console.log('testSingleKvStoreCommit001'); try { @@ -1422,6 +1696,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_COMMIT_0200 + * @tc.name [JS-API8]SingleKvStoreCommit. + * @tc.desc Test Js Api SingleKvStoreCommit testcase 002 + */ it('testSingleKvStoreCommit002', 0, async function (done) { console.log('testSingleKvStoreCommit002'); try { @@ -1437,6 +1716,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_COMMIT_0300 + * @tc.name [JS-API8]SingleKvStoreCommit. + * @tc.desc Test Js Api SingleKvStoreCommit testcase 003 + */ it('testSingleKvStoreCommit003', 0, async function (done) { console.log('testSingleKvStoreCommit003'); try { @@ -1452,6 +1736,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ROLLBACK_0100 + * @tc.name [JS-API8]SingleKvStoreRollback. + * @tc.desc Test Js Api SingleKvStoreRollback testcase 001 + */ it('testSingleKvStoreRollback001', 0, async function (done) { console.log('testSingleKvStoreRollback001'); try { @@ -1467,6 +1756,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ROLLBACK_0200 + * @tc.name [JS-API8]SingleKvStoreRollback. + * @tc.desc Test Js Api SingleKvStoreRollback testcase 002 + */ it('testSingleKvStoreRollback002', 0, async function (done) { console.log('testSingleKvStoreRollback002'); try { @@ -1482,6 +1776,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ROLLBACK_0300 + * @tc.name [JS-API8]SingleKvStoreRollback. + * @tc.desc Test Js Api SingleKvStoreRollback testcase 003 + */ it('testSingleKvStoreRollback003', 0, async function (done) { console.log('testSingleKvStoreRollback003'); try { @@ -1497,6 +1796,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_0100 + * @tc.name [JS-API8]SingleKvStoreEnableSync. + * @tc.desc Test Js Api SingleKvStoreEnableSync testcase 001 + */ it('testSingleKvStoreEnableSync001', 0, async function (done) { console.log('testSingleKvStoreEnableSync001'); try { @@ -1507,7 +1811,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreEnableSync001 enableSync fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreEnableSync001 e ' + e); expect(null).assertFail(); @@ -1515,6 +1818,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_0200 + * @tc.name [JS-API8]SingleKvStoreEnableSync. + * @tc.desc Test Js Api SingleKvStoreEnableSync testcase 002 + */ it('testSingleKvStoreEnableSync002', 0, async function (done) { console.log('testSingleKvStoreEnableSync002'); try { @@ -1525,7 +1833,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreEnableSync002 enableSync fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreEnableSync002 e ' + e); expect(null).assertFail(); @@ -1533,6 +1840,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_0300 + * @tc.name [JS-API8]SingleKvStoreEnableSync. + * @tc.desc Test Js Api SingleKvStoreEnableSync testcase 003 + */ it('testSingleKvStoreEnableSync003', 0, async function (done) { console.log('testSingleKvStoreEnableSync003'); try { @@ -1548,6 +1860,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_ENABLESYNC_0400 + * @tc.name [JS-API8]SingleKvStoreEnableSync. + * @tc.desc Test Js Api SingleKvStoreEnableSync testcase 004 + */ it('testSingleKvStoreEnableSync004', 0, async function (done) { console.log('testSingleKvStoreEnableSync004'); try { @@ -1557,13 +1874,17 @@ describe('SingleKvStorePromiseTest', function () { }).catch((err) => { console.log('testSingleKvStoreEnableSync004 enableSync fail ' + err); }); - }catch(e) { console.log('testSingleKvStoreEnableSync004 e ' + e); } done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0100 + * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. + * @tc.desc Test Js Api SingleKvStoreRemoveDeviceData testcase 001 + */ it('testSingleKvStoreRemoveDeviceData001', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData001'); try { @@ -1574,7 +1895,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreRemoveDeviceData001 put fail ' + err); expect(null).assertFail(); }); - var deviceid = 'no_exist_device_id'; await kvStore.removeDeviceData(deviceid).then((err) => { console.log('testSingleKvStoreRemoveDeviceData001 removeDeviceData success'); @@ -1582,7 +1902,6 @@ describe('SingleKvStorePromiseTest', function () { }).catch((err) => { console.log('testSingleKvStoreRemoveDeviceData001 removeDeviceData fail ' + err); }); - await kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { console.log('testSingleKvStoreRemoveDeviceData001 get success data:' + data); expect(data == VALUE_TEST_STRING_ELEMENT).assertTrue(); @@ -1590,7 +1909,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreRemoveDeviceData001 get fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreRemoveDeviceData001 e ' + e); expect(null).assertFail(); @@ -1598,6 +1916,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0200 + * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. + * @tc.desc Test Js Api SingleKvStoreRemoveDeviceData testcase 002 + */ it('testSingleKvStoreRemoveDeviceData002', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData002'); try { @@ -1613,6 +1936,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0300 + * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. + * @tc.desc Test Js Api SingleKvStoreRemoveDeviceData testcase 003 + */ it('testSingleKvStoreRemoveDeviceData003', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData003'); try { @@ -1628,6 +1956,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0400 + * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. + * @tc.desc Test Js Api SingleKvStoreRemoveDeviceData testcase 004 + */ it('testSingleKvStoreRemoveDeviceData004', 0, async function (done) { console.log('testSingleKvStoreRemoveDeviceData004'); try { @@ -1643,6 +1976,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_0100 + * @tc.name [JS-API8]SingleKvStoreSetSyncParam. + * @tc.desc Test Js Api SingleKvStoreSetSyncParam testcase 001 + */ it('testSingleKvStoreSetSyncParam001', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam001'); try { @@ -1661,6 +1999,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_0200 + * @tc.name [JS-API8]SingleKvStoreSetSyncParam. + * @tc.desc Test Js Api SingleKvStoreSetSyncParam testcase 002 + */ it('testSingleKvStoreSetSyncParam002', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam002'); try { @@ -1676,6 +2019,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_0300 + * @tc.name [JS-API8]SingleKvStoreSetSyncParam. + * @tc.desc Test Js Api SingleKvStoreSetSyncParam testcase 003 + */ it('testSingleKvStoreSetSyncParam003', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam003'); try { @@ -1691,6 +2039,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_SETSYNCPARAM_0400 + * @tc.name [JS-API8]SingleKvStoreSetSyncParam. + * @tc.desc Test Js Api SingleKvStoreSetSyncParam testcase 004 + */ it('testSingleKvStoreSetSyncParam004', 0, async function (done) { console.log('testSingleKvStoreSetSyncParam004'); try { @@ -1706,6 +2059,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_0100 + * @tc.name [JS-API8]SingleKvStoreGetSecurityLevel. + * @tc.desc Test Js Api SingleKvStoreGetSecurityLevel testcase 001 + */ it('testSingleKvStoreGetSecurityLevel001', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel001'); try { @@ -1723,6 +2081,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_0200 + * @tc.name [JS-API8]SingleKvStoreGetSecurityLevel. + * @tc.desc Test Js Api SingleKvStoreGetSecurityLevel testcase 002 + */ it('testSingleKvStoreGetSecurityLevel002', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel002'); try { @@ -1738,6 +2101,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_0300 + * @tc.name [JS-API8]SingleKvStoreGetSecurityLevel. + * @tc.desc Test Js Api SingleKvStoreGetSecurityLevel testcase 003 + */ it('testSingleKvStoreGetSecurityLevel003', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel003'); try { @@ -1753,6 +2121,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETSECURITYLEVEL_0400 + * @tc.name [JS-API8]SingleKvStoreGetSecurityLevel. + * @tc.desc Test Js Api SingleKvStoreGetSecurityLevel testcase 004 + */ it('testSingleKvStoreGetSecurityLevel004', 0, async function (done) { console.log('testSingleKvStoreGetSecurityLevel004'); try { @@ -1768,6 +2141,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_0100 + * @tc.name [JS-API8]SingleKvStoreGetResultSet. + * @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 001 + */ it('testSingleKvStoreGetResultSet001', 0, async function (done) { console.log('testSingleKvStoreGetResultSet001'); try { @@ -1806,7 +2184,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreGetResultSet001 closeResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreGetResultSet001 e ' + e); expect(null).assertFail(); @@ -1814,6 +2191,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_0200 + * @tc.name [JS-API8]SingleKvStoreGetResultSet. + * @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 002 + */ it('testSingleKvStoreGetResultSet002', 0, async function (done) { console.log('testSingleKvStoreGetResultSet002'); try { @@ -1840,6 +2222,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_0300 + * @tc.name [JS-API8]SingleKvStoreGetResultSet. + * @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 003 + */ it('testSingleKvStoreGetResultSet003', 0, async function (done) { console.log('testSingleKvStoreGetResultSet003'); try { @@ -1849,7 +2236,6 @@ describe('SingleKvStorePromiseTest', function () { expect(null).assertFail(); }).catch((err) => { console.log('testSingleKvStoreGetResultSet003 getResultSet fail ' + err); - }); }catch(e) { console.log('testSingleKvStoreGetResultSet003 e ' + e); @@ -1858,6 +2244,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_0400 + * @tc.name [JS-API8]SingleKvStoreGetResultSet. + * @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 004 + */ it('testSingleKvStoreGetResultSet004', 0, async function (done) { console.log('testSingleKvStoreGetResultSet004'); try { @@ -1875,6 +2266,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_0500 + * @tc.name [JS-API8]SingleKvStoreGetResultSet. + * @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 005 + */ it('testSingleKvStoreGetResultSet005', 0, async function (done) { console.log('testSingleKvStoreGetResultSet005'); try { @@ -1915,7 +2311,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreGetResultSet005 closeResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreGetResultSet005 e ' + e); expect(null).assertFail(); @@ -1923,6 +2318,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSET_0600 + * @tc.name [JS-API8]SingleKvStoreGetResultSet. + * @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 006 + */ it('testSingleKvStoreGetResultSet006', 0, async function (done) { console.log('testSingleKvStoreGetResultSet006'); try { @@ -1963,7 +2363,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreGetResultSet006 closeResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreGetResultSet006 e ' + e); expect(null).assertFail(); @@ -1971,6 +2370,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_0100 + * @tc.name [JS-API8]SingleKvStoreCloseResultSet. + * @tc.desc Test Js Api SingleKvStoreCloseResultSet testcase 001 + */ it('testSingleKvStoreCloseResultSet001', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet001'); try { @@ -1989,6 +2393,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_0200 + * @tc.name [JS-API8]SingleKvStoreCloseResultSet. + * @tc.desc Test Js Api SingleKvStoreCloseResultSet testcase 002 + */ it('testSingleKvStoreCloseResultSet002', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet002'); try { @@ -2015,6 +2424,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_0300 + * @tc.name [JS-API8]SingleKvStoreCloseResultSet. + * @tc.desc Test Js Api SingleKvStoreCloseResultSet testcase 003 + */ it('testSingleKvStoreCloseResultSet003', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet003'); try { @@ -2033,10 +2447,14 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_CLOSERESULTSET_0400 + * @tc.name [JS-API8]SingleKvStoreCloseResultSet. + * @tc.desc Test Js Api SingleKvStoreCloseResultSet testcase 004 + */ it('testSingleKvStoreCloseResultSet004', 0, async function (done) { console.log('testSingleKvStoreCloseResultSet004'); try { - // pass query console.log('testSingleKvStoreCloseResultSet004 success'); }catch(e) { console.log('testSingleKvStoreCloseResultSet004 e ' + e); @@ -2045,7 +2463,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) - + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSIZE_0100 + * @tc.name [JS-API8]SingleKvStoreGetResultSize. + * @tc.desc Test Js Api SingleKvStoreGetResultSize testcase 001 + */ it('testSingleKvStoreGetResultSize001', 0, async function (done) { console.log('testSingleKvStoreGetResultSize001'); try { @@ -2070,7 +2492,6 @@ describe('SingleKvStorePromiseTest', function () { }); var query = new factory.Query(); query.prefixKey("batch_test"); - await kvStore.getResultSize(query).then((resultSize) => { console.log('testSingleKvStoreGetResultSize001 getResultSet success'); expect(resultSize == 10).assertTrue(); @@ -2078,7 +2499,6 @@ describe('SingleKvStorePromiseTest', function () { console.log('testSingleKvStoreGetResultSize001 getResultSet fail ' + err); expect(null).assertFail(); }); - }catch(e) { console.log('testSingleKvStoreGetResultSize001 e ' + e); expect(null).assertFail(); @@ -2086,6 +2506,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSIZE_0200 + * @tc.name [JS-API8]SingleKvStoreGetResultSize. + * @tc.desc Test Js Api SingleKvStoreGetResultSize testcase 002 + */ it('testSingleKvStoreGetResultSize002', 0, async function (done) { console.log('testSingleKvStoreGetResultSize001'); try { @@ -2110,7 +2535,6 @@ describe('SingleKvStorePromiseTest', function () { }); var query = new factory.Query(); query.prefixKey("batch_test"); - await kvStore.getResultSize(query).then((resultSize) => { console.log('testSingleKvStoreGetResultSize001 getResultSet success'); expect(resultSize == 10).assertTrue(); @@ -2125,6 +2549,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETENTRIES_0100 + * @tc.name [JS-API8]SingleKvStoreGetEntries. + * @tc.desc Test Js Api SingleKvStoreGetEntries testcase 001 + */ it('testSingleKvStoreGetEntries001', 0, async function (done) { console.log('testSingleKvStoreGetEntries001'); try { @@ -2167,6 +2596,11 @@ describe('SingleKvStorePromiseTest', function () { done(); }) + /** + * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETENTRIES_0200 + * @tc.name [JS-API8]SingleKvStoreGetEntries. + * @tc.desc Test Js Api SingleKvStoreGetEntries testcase 002 + */ it('testSingleKvStoreGetEntries002', 0, async function (done) { console.log('testSingleKvStoreGetEntries002'); try { -- GitLab