KvStoreResultSetJsunit.test.js 41.5 KB
Newer Older
1
/*
2
 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 4 5 6 7 8 9 10 11 12 13 14 15
 * 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
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
X
xsterling 已提交
16
import factory from '@ohos.data.distributedData';
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

const TEST_BUNDLE_NAME = 'ohos.acts.distributeddatamgr';
const TEST_STORE_ID = 'storeId';
var kvManager = null;
var kvStore = null;
var resultSet = null;

describe('KvStoreResultSetTest', function() {
    const config = {
        bundleName : TEST_BUNDLE_NAME,
        userInfo : {
            userId : '0',
            userType : factory.UserType.SAME_USER_ID
        }
    }

    const options = {
        createIfMissing : true,
        encrypt : false,
        backup : false,
        autoSync : true,
        kvStoreType : factory.KVStoreType.SINGLE_VERSION,
        schema : '',
        securityLevel : factory.SecurityLevel.S2,
    }

    beforeAll(async function (done) {
L
liangzhenyu123 已提交
44 45
        console.info('beforeAll');
        console.info('beforeAll config:' + JSON.stringify(config));
46 47
        await factory.createKVManager(config).then((manager) => {
            kvManager = manager;
L
liangzhenyu123 已提交
48
            console.info('beforeAll createKVManager success');
49
        }).catch((err) => {
L
liangzhenyu123 已提交
50
            console.info('beforeAll createKVManager err ' + err);
51 52
        });
        await kvManager.getAllKVStoreId(TEST_BUNDLE_NAME).then(async (data) => {
L
liangzhenyu123 已提交
53
            console.info('beforeAll getAllKVStoreId size = ' + data.length);
54 55
            for (var i = 0; i < data.length; i++) {
                await kvManager.deleteKVStore(TEST_BUNDLE_NAME, data[i]).then(() => {
L
liangzhenyu123 已提交
56
                    console.info('beforeAll deleteKVStore success ' + data[i]);
57
                }).catch((err) => {
L
liangzhenyu123 已提交
58 59
                    console.info('beforeAll deleteKVStore store: ' + data[i]);
                    console.info('beforeAll deleteKVStore error ' + err);
60 61 62
                });
            }
        }).catch((err) => {
L
liangzhenyu123 已提交
63
            console.info('beforeAll getAllKVStoreId err ' + err);
64 65
        });

L
liangzhenyu123 已提交
66
        console.info('beforeAll end');
67 68 69 70
        done();
    })

    afterAll(async function (done) {
L
liangzhenyu123 已提交
71
        console.info('afterAll');
72 73 74 75 76 77
        kvManager = null;
        kvStore = null;
        done();
    })

    beforeEach(async function (done) {
L
liangzhenyu123 已提交
78
        console.info('beforeEach');
79 80
        await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => {
            kvStore = store;
L
liangzhenyu123 已提交
81
            console.info('beforeEach getKVStore success');
82
        }).catch((err) => {
L
liangzhenyu123 已提交
83
            console.info('beforeEach getKVStore err ' + err);
84 85 86 87 88 89 90 91 92 93 94 95 96 97
        });
        let entries = [];
        for (var i = 0; i < 10; i++) {
            var key = 'batch_test_string_key';
            var entry = {
                key : key + i,
                value : {
                    type : factory.ValueType.STRING,
                    value : 'batch_test_string_value'
                }
            }
            entries.push(entry);
        }
        await kvStore.putBatch(entries).then(async (err) => {
L
liangzhenyu123 已提交
98
            console.info('beforeEach putBatch success');
99
        }).catch((err) => {
L
liangzhenyu123 已提交
100
            console.info('beforeEach putBatch fail ' + err);
101 102
        });
        await kvStore.getResultSet('batch_test_string_key').then((result) => {
L
liangzhenyu123 已提交
103
            console.info('beforeEach getResultSet success');
104 105
            resultSet = result;
        }).catch((err) => {
L
liangzhenyu123 已提交
106
            console.info('beforeEach getResultSet fail ' + err);
107
        });
L
liangzhenyu123 已提交
108
        console.info('beforeEach end');
109 110 111 112
        done();
    })

    afterEach(async function (done) {
L
liangzhenyu123 已提交
113
        console.info('afterEach');
114
        await kvStore.closeResultSet(resultSet).then((err) => {
L
liangzhenyu123 已提交
115
            console.info('afterEach closeResultSet success');
116
        }).catch((err) => {
L
liangzhenyu123 已提交
117
            console.info('afterEach closeResultSet fail ' + err);
118 119
        });
        await kvManager.closeKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID, kvStore).then(async () => {
L
liangzhenyu123 已提交
120
            console.info('afterEach closeKVStore success');
121
            await kvManager.deleteKVStore(TEST_BUNDLE_NAME, TEST_STORE_ID).then(() => {
L
liangzhenyu123 已提交
122
                console.info('afterEach deleteKVStore success');
123
            }).catch((err) => {
L
liangzhenyu123 已提交
124
                console.info('afterEach deleteKVStore err ' + err);
125 126
            });
        }).catch((err) => {
L
liangzhenyu123 已提交
127
            console.info('afterEach closeKVStore err ' + err);
128
        });
X
xsterling 已提交
129 130
        kvStore = null;
        resultSet = null;
131 132 133
        done();
    })

134 135 136 137 138
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0100
     * @tc.name [JS-API8]KvStoreResultSet.GetCount()
     * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 001
     */
139 140 141
    it('testKvStoreResultSetGetCount001', 0, async function(done) {
        try {
            var count = resultSet.getCount();
L
liangzhenyu123 已提交
142
            console.info("testKvStoreResultSetGetCount001 getCount " + count);
143 144
            expect(count == 10).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
145
            console.info("testKvStoreResultSetGetCount001 fail " + e);
146 147 148 149 150
            expect(null).assertFail();
        }
        done();
    })

151 152 153 154 155
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0200
     * @tc.name [JS-API8]KvStoreResultSet.GetCount()
     * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 002
     */
156 157 158 159
    it('testKvStoreResultSetGetCount002', 0, async function(done) {
        try {
            var rs;
            await kvStore.getResultSet('test').then((result) => {
L
liangzhenyu123 已提交
160
                console.info('testKvStoreResultSetGetCount002 getResultSet success');
161 162 163
                rs = result;
                expect(rs.getCount() == 0).assertTrue();
            }).catch((err) => {
L
liangzhenyu123 已提交
164
                console.info('testKvStoreResultSetGetCount002 getResultSet fail ' + err);
165 166 167
                expect(null).assertFail();
            });
            await kvStore.closeResultSet(rs).then((err) => {
L
liangzhenyu123 已提交
168
                console.info('testKvStoreResultSetGetCount002 closeResultSet success');
169
            }).catch((err) => {
L
liangzhenyu123 已提交
170
                console.info('testKvStoreResultSetGetCount002 closeResultSet fail ' + err);
171 172 173
                expect(null).assertFail();
            });
        } catch (e) {
L
liangzhenyu123 已提交
174
            console.info('testKvStoreResultSetGetCount002 e ' + e);
175 176 177 178 179
            expect(null).assertFail();
        }
        done();
    })

180 181 182 183 184
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0300
     * @tc.name [JS-API8]KvStoreResultSet.GetCount()
     * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 003
     */
185 186 187
    it('testKvStoreResultSetGetCount003', 0, async function(done) {
        try {
            var count = resultSet.getCount(123);
L
liangzhenyu123 已提交
188
            console.info("testKvStoreResultSetGetCount003 getCount " + count);
189 190
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
191
            console.info("testKvStoreResultSetGetCount003 fail " + e);
192 193 194 195
        }
        done();
    })

196 197 198 199 200
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETCOUNT_0400
     * @tc.name [JS-API8]KvStoreResultSet.GetCount()
     * @tc.desc Test Js Api KvStoreResultSet.GetCount()testcase 004
     */
201 202 203
    it('testKvStoreResultSetGetCount004', 0, async function(done) {
        try {
            var count = resultSet.getCount(123, 'test_string');
L
liangzhenyu123 已提交
204
            console.info("testKvStoreResultSetGetCount004 getCount " + count);
205 206
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
207
            console.info("testKvStoreResultSetGetCount004 fail " + e);
208 209 210 211
        }
        done();
    })

212 213 214 215 216
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0100
     * @tc.name [JS-API8]KvStoreResultSet.GetPosition()
     * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 001
     */
217 218
    it('testKvStoreResultSetGetPosition001', 0, async function(done) {
        try {
Y
yanglei1217 已提交
219
            var position = resultSet.getPosition();
L
liangzhenyu123 已提交
220
            console.info("testKvStoreResultSetGetPosition001 getPosition " + position);
Y
yanglei1217 已提交
221
            expect(position == -1).assertTrue();
222
        } catch (e) {
L
liangzhenyu123 已提交
223
            console.info("testKvStoreResultSetGetPosition001 fail " + e);
224 225 226 227 228
            expect(null).assertFail();
        }
        done();
    })

229 230 231 232 233
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0200
     * @tc.name [JS-API8]KvStoreResultSet.GetPosition()
     * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 002
     */
234 235
    it('testKvStoreResultSetGetPosition002', 0, async function(done) {
        try {
Y
yanglei1217 已提交
236
            var position = resultSet.getPosition();
L
liangzhenyu123 已提交
237
            console.info("testKvStoreResultSetGetPosition002 getPosition " + position);
Y
yanglei1217 已提交
238
            expect(position).assertEqual(-1);
239 240
            var flag = resultSet.moveToLast();
            expect(flag).assertTrue();
Y
yanglei1217 已提交
241 242
            position = resultSet.getPosition();
            expect(position).assertEqual(9);
243
        } catch (e) {
L
liangzhenyu123 已提交
244
            console.info("testKvStoreResultSetGetPosition002 fail " + e);
245 246 247 248 249
            expect(null).assertFail();
        }
        done();
    })

250 251 252 253 254
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0300
     * @tc.name [JS-API8]KvStoreResultSet.GetPosition()
     * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 003
     */
255 256
    it('testKvStoreResultSetGetPosition003', 0, async function(done) {
        try {
Y
yanglei1217 已提交
257
            var position = resultSet.getPosition(123);
L
liangzhenyu123 已提交
258
            console.info("testKvStoreResultSetGetPosition003 getPosition " + position);
259 260
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
261
            console.info("testKvStoreResultSetGetPosition003 fail " + e);
262 263 264 265
        }
        done();
    })

266 267 268 269 270
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETPOSITION_0400
     * @tc.name [JS-API8]KvStoreResultSet.GetPosition()
     * @tc.desc Test Js Api KvStoreResultSet.GetPosition()testcase 004
     */
271 272
    it('testKvStoreResultSetGetPosition004', 0, async function(done) {
        try {
Y
yanglei1217 已提交
273
            var position = resultSet.getPosition(123, 'test_string');
L
liangzhenyu123 已提交
274
            console.info("testKvStoreResultSetGetPosition004 getPosition " + position);
275 276
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
277
            console.info("testKvStoreResultSetGetPosition004 fail " + e);
278 279 280 281
        }
        done();
    })

282 283 284 285 286
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0100
     * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 001
     */
287 288 289
    it('testKvStoreResultSetMoveToFirst001', 0, async function(done) {
        try {
            var moved = resultSet.moveToFirst();
L
liangzhenyu123 已提交
290
            console.info("testKvStoreResultSetMoveToFirst001 moveToFirst " + moved);
291 292 293
            expect(moved).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
294
            console.info("testKvStoreResultSetMoveToFirst001 fail " + e);
295 296 297 298
        }
        done();
    })

299 300 301 302 303
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0200
     * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 002
     */
304 305 306
    it('testKvStoreResultSetMoveToFirst002', 0, async function(done) {
        try {
            var moved = resultSet.moveToFirst();
L
liangzhenyu123 已提交
307
            console.info("testKvStoreResultSetMoveToFirst002 moveToFirst " + moved);
308 309
            expect(moved).assertTrue();
            var pos = resultSet.getPosition();
L
liangzhenyu123 已提交
310
            console.info("testKvStoreResultSetMoveToFirst002 getPosition " + pos);
311 312 313
            expect(pos == 0).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
314
            console.info("testKvStoreResultSetMoveToFirst002 fail " + e);
315 316 317 318
        }
        done();
    })

319 320 321 322 323
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0300
     * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 003
     */
324 325 326
    it('testKvStoreResultSetMoveToFirst003', 0, async function(done) {
        try {
            var moved = resultSet.moveToFirst(123);
L
liangzhenyu123 已提交
327
            console.info("testKvStoreResultSetMoveToFirst003 moveToFirst " + moved);
328 329
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
330
            console.info("testKvStoreResultSetMoveToFirst003 fail " + e);
331 332 333 334
        }
        done();
    })

335 336 337 338 339
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0400
     * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 004
     */
340 341 342
    it('testKvStoreResultSetMoveToFirst004', 0, async function(done) {
        try {
            var moved = resultSet.moveToFirst(123, 'test_string');
L
liangzhenyu123 已提交
343
            console.info("testKvStoreResultSetMoveToFirst004 moveToFirst " + moved);
344 345
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
346
            console.info("testKvStoreResultSetMoveToFirst004 fail " + e);
347 348 349 350
        }
        done();
    })

351 352 353 354 355
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOFIRST_0500
     * @tc.name [JS-API8]KvStoreResultSet.MoveToFirst()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToFirst()testcase 005
     */
356 357 358
    it('testKvStoreResultSetMoveToFirst005', 0, async function(done) {
        try {
            var moved = resultSet.moveToLast();
L
liangzhenyu123 已提交
359
            console.info("testKvStoreResultSetMoveToFirst004 moveToFirst " + moved);
360 361 362 363
            expect(moved && (resultSet.getPosition() == 9)).assertTrue();
            moved = resultSet.moveToFirst();
            expect(moved && (resultSet.getPosition() == 0)).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
364
            console.info("testKvStoreResultSetMoveToFirst004 fail " + e);
365 366 367 368
        }
        done();
    })

369 370 371 372 373
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0100
     * @tc.name [JS-API8]KvStoreResultSet.MoveToLast()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 001
     */
374 375 376
    it('testKvStoreResultSetMoveToLast001', 0, async function(done) {
        try {
            var moved = resultSet.moveToLast();
L
liangzhenyu123 已提交
377
            console.info("testKvStoreResultSetMoveToLast001 moveToLast " + moved);
378 379 380
            expect(moved).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
381
            console.info("testKvStoreResultSetMoveToLast001 fail " + e);
382 383 384 385
        }
        done();
    })

386 387 388 389 390
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0200
     * @tc.name [JS-API8]KvStoreResultSet.MoveToLast()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 002
     */
391 392 393
    it('testKvStoreResultSetMoveToLast002', 0, async function(done) {
        try {
            var moved = resultSet.moveToLast();
L
liangzhenyu123 已提交
394
            console.info("testKvStoreResultSetMoveToLast002 moveToLast " + moved);
395 396 397
            expect(moved && (resultSet.getPosition() == 9)).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
398
            console.info("testKvStoreResultSetMoveToLast002 fail " + e);
399 400 401 402
        }
        done();
    })

403 404 405 406 407
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0300
     * @tc.name [JS-API8]KvStoreResultSet.MoveToLast()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 003
     */
408 409 410
    it('testKvStoreResultSetMoveToLast003', 0, async function(done) {
        try {
            var moved = resultSet.moveToLast(123);
L
liangzhenyu123 已提交
411
            console.info("testKvStoreResultSetMoveToLast003 moveToLast " + moved);
412 413
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
414
            console.info("testKvStoreResultSetMoveToLast003 fail " + e);
415 416 417 418
        }
        done();
    })

419 420 421 422 423
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOLAST_0400
     * @tc.name [JS-API8]KvStoreResultSet.MoveToLast()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToLast()testcase 004
     */
424 425 426
    it('testKvStoreResultSetMoveToLast004', 0, async function(done) {
        try {
            var moved = resultSet.moveToLast(123, 'test_string');
L
liangzhenyu123 已提交
427
            console.info("testKvStoreResultSetMoveToLast004 moveToLast " + moved);
428 429
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
430
            console.info("testKvStoreResultSetMoveToLast004 fail " + e);
431 432 433 434
        }
        done();
    })

435 436 437 438 439
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0100
     * @tc.name [JS-API8]KvStoreResultSet.MoveToNext()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 001
     */
440 441 442
    it('testKvStoreResultSetMoveToNext001', 0, async function(done) {
        try {
            var moved = resultSet.moveToNext();
L
liangzhenyu123 已提交
443
            console.info("testKvStoreResultSetMoveToNext001 moveToNext " + moved);
444 445 446
            expect(moved && (resultSet.getPosition() == 0)).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
447
            console.info("testKvStoreResultSetMoveToNext001 fail " + e);
448 449 450 451
        }
        done();
    })

452 453 454 455 456
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0200
     * @tc.name [JS-API8]KvStoreResultSet.MoveToNext()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 002
     */
457 458 459
    it('testKvStoreResultSetMoveToNext002', 0, async function(done) {
        try {
            var moved = resultSet.moveToNext();
L
liangzhenyu123 已提交
460
            console.info("testKvStoreResultSetMoveToNext002 moveToNext " + moved);
461 462 463 464 465
            expect(moved && (resultSet.getPosition() == 0)).assertTrue();
            moved = resultSet.moveToNext();
            expect(moved && (resultSet.getPosition() == 1)).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
466
            console.info("testKvStoreResultSetMoveToNext002 fail " + e);
467 468 469 470
        }
        done();
    })

471 472 473 474 475
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0300
     * @tc.name [JS-API8]KvStoreResultSet.MoveToNext()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 003
     */
476 477 478
    it('testKvStoreResultSetMoveToNext003', 0, async function(done) {
        try {
            var moved = resultSet.moveToNext(123);
L
liangzhenyu123 已提交
479
            console.info("testKvStoreResultSetMoveToNext003 moveToNext " + moved);
480 481
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
482
            console.info("testKvStoreResultSetMoveToNext003 fail " + e);
483 484 485 486
        }
        done();
    })

487 488 489 490 491
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETONEXT_0400
     * @tc.name [JS-API8]KvStoreResultSet.MoveToNext()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToNext()testcase 004
     */
492 493 494
    it('testKvStoreResultSetMoveToNext004', 0, async function(done) {
        try {
            var moved = resultSet.moveToNext(123, 'test_string');
L
liangzhenyu123 已提交
495
            console.info("testKvStoreResultSetMoveToNext004 moveToNext " + moved);
496 497
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
498
            console.info("testKvStoreResultSetMoveToNext004 fail " + e);
499 500 501 502
        }
        done();
    })

503 504 505 506 507
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0100
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 001
     */
508 509 510
    it('testKvStoreResultSetMoveToPrevious001', 0, async function(done) {
        try {
            var moved = resultSet.moveToPrevious();
L
liangzhenyu123 已提交
511
            console.info("testKvStoreResultSetMoveToPrevious001 moveToPrevious " + moved);
512 513 514
            expect(!moved).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
515
            console.info("testKvStoreResultSetMoveToPrevious001 fail " + e);
516 517 518 519
        }
        done();
    })

520 521 522 523 524
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0200
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 002
     */
525 526 527 528 529
    it('testKvStoreResultSetMoveToPrevious002', 0, async function(done) {
        try {
            var moved = resultSet.moveToFirst();
            expect(moved && (resultSet.getPosition() == 0)).assertTrue();
            moved = resultSet.moveToNext();
L
liangzhenyu123 已提交
530
            console.info("testKvStoreResultSetMoveToPrevious002 moveToNext " + moved);
531 532
            expect(moved && (resultSet.getPosition() == 1)).assertTrue();
            moved = resultSet.moveToPrevious();
L
liangzhenyu123 已提交
533
            console.info("testKvStoreResultSetMoveToPrevious002 moveToPrevious " + moved);
534 535
            expect(moved && (resultSet.getPosition() == 0)).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
536
            console.info("testKvStoreResultSetMoveToPrevious002 fail " + e);
537 538 539 540 541
            expect(null).assertFail();
        }
        done();
    })

542 543 544 545 546
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0300
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 003
     */
547 548 549
    it('testKvStoreResultSetMoveToPrevious003', 0, async function(done) {
        try {
            var moved = resultSet.moveToPrevious(123);
L
liangzhenyu123 已提交
550
            console.info("testKvStoreResultSetMoveToPrevious003 moveToPrevious " + moved);
551 552
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
553
            console.info("testKvStoreResultSetMoveToPrevious003 fail " + e);
554 555 556 557
        }
        done();
    })

558 559 560 561 562
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0400
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 004
     */
563 564 565
    it('testKvStoreResultSetMoveToPrevious004', 0, async function(done) {
        try {
            var moved = resultSet.moveToPrevious(123, 'test_string');
L
liangzhenyu123 已提交
566
            console.info("testKvStoreResultSetMoveToPrevious004 moveToPrevious " + moved);
567 568
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
569
            console.info("testKvStoreResultSetMoveToPrevious004 fail " + e);
570 571 572 573
        }
        done();
    })

574 575 576 577 578
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPREVIOUS_0500
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPrevious()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPrevious()testcase 005
     */
579 580 581 582 583
    it('testKvStoreResultSetMoveToPrevious005', 0, async function(done) {
        try {
            var moved = resultSet.moveToFirst();
            expect(moved && (resultSet.getPosition() == 0)).assertTrue();
            moved = resultSet.moveToPrevious();
L
liangzhenyu123 已提交
584
            console.info("testKvStoreResultSetMoveToPrevious005 from 0 to -1 return" + moved);
X
xsterling 已提交
585
            expect(moved == false).assertTrue();
L
liangzhenyu123 已提交
586
            console.info("testKvStoreResultSetMoveToPrevious005 from 0 to " + resultSet.getPosition());
587 588
            expect(-1).assertEqual(resultSet.getPosition());
        } catch (e) {
L
liangzhenyu123 已提交
589
            console.info("testKvStoreResultSetMoveToPrevious005 fail " + e);
X
xsterling 已提交
590
            expect(null).assertFail();
591 592 593
        }
        done();
    })
594 595 596 597 598 599

    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0100
     * @tc.name [JS-API8]KvStoreResultSet.Move()
     * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 001
     */
600 601 602
    it('testKvStoreResultSetMove001', 0, async function(done) {
        try {
            var moved = resultSet.move();
L
liangzhenyu123 已提交
603
            console.info("testKvStoreResultSetMove001 move " + moved);
604 605
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
606
            console.info("testKvStoreResultSetMove001 fail " + e);
607 608 609 610
        }
        done();
    })

611 612 613 614 615
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0200
     * @tc.name [JS-API8]KvStoreResultSet.Move()
     * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 002
     */
616 617 618 619 620
    it('testKvStoreResultSetMove002', 0, async function(done) {
        try {
            resultSet.moveToFirst();
            expect(resultSet.getPosition() == 0).assertTrue();
            var moved = resultSet.move(3);
L
liangzhenyu123 已提交
621
            console.info("testKvStoreResultSetMove002 move " + moved);
622 623 624
            expect(moved).assertTrue();
            expect(3).assertEqual(resultSet.getPosition());
        } catch (e) {
L
liangzhenyu123 已提交
625
            console.info("testKvStoreResultSetMove002 fail " + e);
626 627 628 629 630
            expect(null).assertFail();
        }
        done();
    })

631 632 633 634 635
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0300
     * @tc.name [JS-API8]KvStoreResultSet.Move()
     * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 003
     */
636 637 638 639
    it('testKvStoreResultSetMove003', 0, async function(done) {
        try {
            expect(resultSet.getPosition() == -1).assertTrue();
            var moved = resultSet.move(3);
L
liangzhenyu123 已提交
640
            console.info("testKvStoreResultSetMove003 move " + moved);
641 642
            expect(moved && (resultSet.getPosition() == 2)).assertTrue();
            moved = resultSet.move(2);
L
liangzhenyu123 已提交
643
            console.info("testKvStoreResultSetMove003 move " + moved);
644 645
            expect(moved && (resultSet.getPosition() == 4)).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
646
            console.info("testKvStoreResultSetMove003 fail " + e);
647 648 649 650 651
            expect(null).assertFail();
        }
        done();
    })

652 653 654 655 656
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVE_0400
     * @tc.name [JS-API8]KvStoreResultSet.Move()
     * @tc.desc Test Js Api KvStoreResultSet.Move()testcase 004
     */
657 658 659
    it('testKvStoreResultSetMove004', 0, async function(done) {
        try {
            var moved = resultSet.move(3, 'test_string');
L
liangzhenyu123 已提交
660
            console.info("testKvStoreResultSetMove004 move " + moved);
661 662
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
663
            console.info("testKvStoreResultSetMove004 fail " + e);
664 665 666 667
        }
        done();
    })

668 669 670 671 672
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0100
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 001
     */
673 674 675
    it('testKvStoreResultSetMoveToPosition001', 0, async function(done) {
        try {
            var moved = resultSet.moveToPosition();
L
liangzhenyu123 已提交
676
            console.info("testKvStoreResultSetMoveToPosition001 moveToPosition " + moved);
677 678
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
679
            console.info("testKvStoreResultSetMoveToPosition001 fail " + e);
680 681 682 683
        }
        done();
    })

684 685 686 687 688
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0200
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 002
     */
689 690 691
    it('testKvStoreResultSetMoveToPosition002', 0, async function(done) {
        try {
            var moved = resultSet.moveToPosition(1, 'test_string');
L
liangzhenyu123 已提交
692
            console.info("testKvStoreResultSetMoveToPosition002 moveToPosition " + moved);
693 694
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
695
            console.info("testKvStoreResultSetMoveToPosition002 fail " + e);
696 697 698 699
        }
        done();
    })

700 701 702 703 704
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0300
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 003
     */
705 706 707
    it('testKvStoreResultSetMoveToPosition003', 0, async function(done) {
        try {
            var moved = resultSet.moveToPosition(5);
L
liangzhenyu123 已提交
708
            console.info("testKvStoreResultSetMoveToPosition003 moveToPosition " + moved);
709 710
            expect(moved && (resultSet.getPosition() == 5)).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
711
            console.info("testKvStoreResultSetMoveToPosition003 fail " + e);
712 713 714 715
        }
        done();
    })

716 717 718 719 720
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_MOVETOPOSITION_0400
     * @tc.name [JS-API8]KvStoreResultSet.MoveToPosition()
     * @tc.desc Test Js Api KvStoreResultSet.MoveToPosition()testcase 004
     */
721 722 723
    it('testKvStoreResultSetMoveToPosition004', 0, async function(done) {
        try {
            var moved = resultSet.move(3);
L
liangzhenyu123 已提交
724
            console.info("testKvStoreResultSetMoveToPosition004 moveToPosition " + moved);
725 726
            expect(moved && (resultSet.getPosition() == 2)).assertTrue();
            moved = resultSet.moveToPosition(5);
L
liangzhenyu123 已提交
727
            console.info("testKvStoreResultSetMoveToPosition004 moveToPosition " + moved);
728 729
            expect(moved && (resultSet.getPosition() == 5)).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
730
            console.info("testKvStoreResultSetMoveToPosition004 fail " + e);
731 732 733 734
        }
        done();
    })

735 736 737 738 739
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0100
     * @tc.name [JS-API8]KvStoreResultSet.IsFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 001
     */
740 741 742
    it('testKvStoreResultSetIsFirst001', 0, async function(done) {
        try {
            var flag = resultSet.isFirst();
L
liangzhenyu123 已提交
743
            console.info("testKvStoreResultSetIsFirst001 isFirst " + flag);
744 745 746
            expect(!flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
747
            console.info("testKvStoreResultSetIsFirst001 fail " + e);
748 749 750 751
        }
        done();
    })

752 753 754 755 756
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0200
     * @tc.name [JS-API8]KvStoreResultSet.IsFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 002
     */
757 758 759
    it('testKvStoreResultSetIsFirst002', 0, async function(done) {
        try {
            var flag = resultSet.isFirst();
L
liangzhenyu123 已提交
760
            console.info("testKvStoreResultSetIsFirst002 isFirst " + flag);
761 762 763
            expect(!flag).assertTrue();
            resultSet.move(3);
            flag = resultSet.isFirst();
L
liangzhenyu123 已提交
764
            console.info("testKvStoreResultSetIsFirst002 isFirst " + flag);
765 766 767
            expect(!flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
768
            console.info("testKvStoreResultSetIsFirst002 fail " + e);
769 770 771 772
        }
        done();
    })

773 774 775 776 777
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0300
     * @tc.name [JS-API8]KvStoreResultSet.IsFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 003
     */
778 779 780
    it('testKvStoreResultSetIsFirst003', 0, async function(done) {
        try {
            var flag = resultSet.isFirst(1);
L
liangzhenyu123 已提交
781
            console.info("testKvStoreResultSetIsFirst003 isFirst " + flag);
782 783
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
784
            console.info("testKvStoreResultSetIsFirst003 fail " + e);
785 786 787 788
        }
        done();
    })

789 790 791 792 793
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISFIRST_0400
     * @tc.name [JS-API8]KvStoreResultSet.IsFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsFirst()testcase 004
     */
794 795 796
    it('testKvStoreResultSetIsFirst004', 0, async function(done) {
        try {
            var flag = resultSet.isFirst(1, 'test_string');
L
liangzhenyu123 已提交
797
            console.info("testKvStoreResultSetIsFirst004 isFirst " + flag);
798 799
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
800
            console.info("testKvStoreResultSetIsFirst004 fail " + e);
801 802 803 804
        }
        done();
    })

805 806 807 808 809
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0100
     * @tc.name [JS-API8]KvStoreResultSet.IsLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 001
     */
810 811 812
    it('testKvStoreResultSetIsLast001', 0, async function(done) {
        try {
            var flag = resultSet.isLast();
L
liangzhenyu123 已提交
813
            console.info("testKvStoreResultSetIsLast001 isLast " + flag);
814 815 816
            expect(!flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
817
            console.info("testKvStoreResultSetIsFirst004 fail " + e);
818 819 820 821
        }
        done();
    })

822 823 824 825 826
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0200
     * @tc.name [JS-API8]KvStoreResultSet.IsLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 002
     */
827 828 829 830
    it('testKvStoreResultSetIsLast002', 0, async function(done) {
        try {
            resultSet.moveToLast();
            var flag = resultSet.isLast();
L
liangzhenyu123 已提交
831
            console.info("testKvStoreResultSetIsLast002 isLast " + flag);
832 833 834
            expect(flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
835
            console.info("testKvStoreResultSetIsLast002 fail " + e);
836 837 838 839
        }
        done();
    })

840 841 842 843 844
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0300
     * @tc.name [JS-API8]KvStoreResultSet.IsLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 003
     */
845 846 847
    it('testKvStoreResultSetIsLast003', 0, async function(done) {
        try {
            var flag = resultSet.isLast(1);
L
liangzhenyu123 已提交
848
            console.info("testKvStoreResultSetIsLast003 isLast " + flag);
849 850
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
851
            console.info("testKvStoreResultSetIsLast003 fail " + e);
852 853 854 855
        }
        done();
    })

856 857 858 859 860
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISLAST_0400
     * @tc.name [JS-API8]KvStoreResultSet.IsLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsLast()testcase 004
     */
861 862 863
    it('testKvStoreResultSetIsLast004', 0, async function(done) {
        try {
            var flag = resultSet.isLast(1, 'test_string');
L
liangzhenyu123 已提交
864
            console.info("testKvStoreResultSetIsLast004 isLast " + flag);
865 866
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
867
            console.info("testKvStoreResultSetIsLast004 fail " + e);
868 869 870 871
        }
        done();
    })

872 873 874 875 876
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0100
     * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 001
     */
877 878 879
    it('testKvStoreResultSetIsBeforeFirst001', 0, async function(done) {
        try {
            var flag = resultSet.isBeforeFirst();
L
liangzhenyu123 已提交
880
            console.info("testKvStoreResultSetIsBeforeFirst001 isBeforeFirst " + flag);
881 882 883
            expect(flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
884
            console.info("testKvStoreResultSetIsBeforeFirst001 fail " + e);
885 886 887 888
        }
        done();
    })

889 890 891 892 893
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0200
     * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 002
     */
894 895 896 897 898
    it('testKvStoreResultSetIsBeforeFirst002', 0, async function(done) {
        try {
            var moved = resultSet.moveToPrevious();
            expect(!moved).assertTrue();
            var flag = resultSet.isBeforeFirst();
L
liangzhenyu123 已提交
899
            console.info("testKvStoreResultSetIsBeforeFirst002 isBeforeFirst " + flag);
900 901 902
            expect(flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
903
            console.info("testKvStoreResultSetIsBeforeFirst002 fail " + e);
904 905 906 907
        }
        done();
    })

908 909 910 911 912
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0300
     * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 003
     */
913 914 915
    it('testKvStoreResultSetIsBeforeFirst003', 0, async function(done) {
        try {
            var flag = resultSet.isBeforeFirst(1);
L
liangzhenyu123 已提交
916
            console.info("testKvStoreResultSetIsBeforeFirst003 isBeforeFirst " + flag);
917 918
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
919
            console.info("testKvStoreResultSetIsBeforeFirst003 fail " + e);
920 921 922 923
        }
        done();
    })

924 925 926 927 928
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISBEFOREFIRST_0400
     * @tc.name [JS-API8]KvStoreResultSet.IsBeforeFirst()
     * @tc.desc Test Js Api KvStoreResultSet.IsBeforeFirst()testcase 004
     */
929 930 931
    it('testKvStoreResultSetIsBeforeFirst004', 0, async function(done) {
        try {
            var flag = resultSet.isBeforeFirst(1, 'test_string');
L
liangzhenyu123 已提交
932
            console.info("testKvStoreResultSetIsBeforeFirst004 isBeforeFirst " + flag);
933 934
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
935
            console.info("testKvStoreResultSetIsBeforeFirst004 fail " + e);
936 937 938 939
        }
        done();
    })

940 941 942 943 944
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0100
     * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 001
     */
945 946 947
    it('testKvStoreResultSetIsAfterLast001', 0, async function(done) {
        try {
            var flag = resultSet.isAfterLast();
L
liangzhenyu123 已提交
948
            console.info("testKvStoreResultSetIsAfterLast001 isAfterLast " + flag);
949 950 951
            expect(!flag).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
952
            console.info("testKvStoreResultSetIsAfterLast001 fail " + e);
953 954 955 956
        }
        done();
    })

957 958 959 960 961
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0200
     * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 002
     */
962 963 964
    it('testKvStoreResultSetIsAfterLast002', 0, async function(done) {
        try {
            var moved = resultSet.moveToLast();
L
liangzhenyu123 已提交
965
            console.info("testKvStoreResultSetIsAfterLast002  moveToLast  moved=" + moved);
966 967
            expect(moved).assertTrue();
            moved = resultSet.moveToNext();
L
liangzhenyu123 已提交
968
            console.info("testKvStoreResultSetIsAfterLast002  moveToNext  moved=" + moved);
X
xsterling 已提交
969
            expect(moved == false).assertTrue();
970
            var flag = resultSet.isAfterLast();
L
liangzhenyu123 已提交
971
            console.info("testKvStoreResultSetIsAfterLast002  isAfterLast true=" + flag);
972 973
            expect(flag).assertTrue();
        } catch (e) {
L
liangzhenyu123 已提交
974
            console.info("testKvStoreResultSetIsAfterLast002 fail " + e);
975 976 977 978 979
            expect(null).assertFail();
        }
        done();
    })

980 981 982 983 984
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0300
     * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 003
     */
985 986 987
    it('testKvStoreResultSetIsAfterLast003', 0, async function(done) {
        try {
            var flag = resultSet.isAfterLast(1);
L
liangzhenyu123 已提交
988
            console.info("testKvStoreResultSetIsAfterLast003 isAfterLast " + flag);
989 990
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
991
            console.info("testKvStoreResultSetIsAfterLast003 fail " + e);
992 993 994 995
        }
        done();
    })

996 997 998 999 1000
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_ISAFTERLAST_0400
     * @tc.name [JS-API8]KvStoreResultSet.IsAfterLast()
     * @tc.desc Test Js Api KvStoreResultSet.IsAfterLast()testcase 004
     */
1001 1002 1003
    it('testKvStoreResultSetIsAfterLast004', 0, async function(done) {
        try {
            var flag = resultSet.isAfterLast(1, 'test_string');
L
liangzhenyu123 已提交
1004
            console.info("testKvStoreResultSetIsAfterLast004 isAfterLast " + flag);
1005 1006
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
1007
            console.info("testKvStoreResultSetIsAfterLast004 fail " + e);
1008 1009 1010 1011
        }
        done();
    })

1012 1013 1014 1015 1016
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0100
     * @tc.name [JS-API8]KvStoreResultSet.GetEntry()
     * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 001
     */
1017 1018 1019 1020
    it('testKvStoreResultSetGetEntry001', 0, async function(done) {
        try {
            var moved = resultSet.moveToNext();
            var entry = resultSet.getEntry();
L
liangzhenyu123 已提交
1021
            console.info("testKvStoreResultSetGetEntry001 getEntry " + entry);
1022 1023 1024 1025
            expect(moved && (entry.key == 'batch_test_string_key0')).assertTrue();
            expect(moved && (entry.value.value == 'batch_test_string_value')).assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
1026
            console.info("testKvStoreResultSetGetEntry001 fail " + e);
1027 1028 1029 1030
        }
        done();
    })

1031 1032 1033 1034 1035
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0200
     * @tc.name [JS-API8]KvStoreResultSet.GetEntry()
     * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 002
     */
1036 1037 1038 1039
    it('testKvStoreResultSetGetEntry002', 0, async function(done) {
        try {
            var moved = resultSet.moveToNext();
            var entry = resultSet.getEntry();
L
liangzhenyu123 已提交
1040
            console.info("testKvStoreResultSetGetEntry002 getEntry " + entry);
1041 1042 1043 1044 1045
            expect(entry.key == 'batch_test_string_key0').assertTrue();
            expect(entry.value.value == 'batch_test_string_value').assertTrue();
            moved = resultSet.moveToNext();
            expect(moved).assertTrue();
            entry = resultSet.getEntry();
L
liangzhenyu123 已提交
1046
            console.info("testKvStoreResultSetGetEntry002 getEntry " + entry);
1047 1048 1049 1050
            expect(entry.key == 'batch_test_string_key1').assertTrue();
            expect(entry.value.value == 'batch_test_string_value').assertTrue();
        } catch (e) {
            expect(null).assertFail();
L
liangzhenyu123 已提交
1051
            console.info("testKvStoreResultSetGetEntry002 fail " + e);
1052 1053 1054 1055
        }
        done();
    })

1056 1057 1058 1059 1060
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0300
     * @tc.name [JS-API8]KvStoreResultSet.GetEntry()
     * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 003
     */
1061 1062 1063
    it('testKvStoreResultSetGetEntry003', 0, async function(done) {
        try {
            var entry = resultSet.getEntry(1);
L
liangzhenyu123 已提交
1064
            console.info("testKvStoreResultSetGetEntry003 getEntry " + entry);
1065 1066
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
1067
            console.info("testKvStoreResultSetGetEntry003 fail " + e);
1068 1069 1070 1071
        }
        done();
    })

1072 1073 1074 1075 1076
    /**
     * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORERESULTSET_GETENTRY_0400
     * @tc.name [JS-API8]KvStoreResultSet.GetEntry()
     * @tc.desc Test Js Api KvStoreResultSet.GetEntry()testcase 004
     */
1077 1078 1079
    it('testKvStoreResultSetGetEntry004', 0, async function(done) {
        try {
            var entry = resultSet.getEntry(1, 'test_string');
L
liangzhenyu123 已提交
1080
            console.info("testKvStoreResultSetGetEntry004 getEntry " + entry);
1081 1082
            expect(null).assertFail();
        } catch (e) {
L
liangzhenyu123 已提交
1083
            console.info("testKvStoreResultSetGetEntry004 fail " + e);
1084 1085 1086 1087
        }
        done();
    })
})