未验证 提交 2b4dd79a 编写于 作者: O openharmony_ci 提交者: Gitee

!5510 【Distributeddatamgr】【master】用例优化

Merge pull request !5510 from 梁梁/master
......@@ -1801,16 +1801,14 @@ describe('deviceKvStoreCallbackTest', function () {
await kvStore.removeDeviceData('', function (err,data) {
if (err == undefined) {
console.info('testDeviceKvStoreRemoveDeviceData103 removeDeviceData success');
expect(err == undefined).assertTrue();
} else {
console.info('testDeviceKvStoreRemoveDeviceData103 removeDeviceData fail ' + err);
expect(null).assertFail();
} else {
console.info('testDeviceKvStoreRemoveDeviceData103 removeDeviceData fail');
}
done();
});
}catch(e) {
console.info('testDeviceKvStoreRemoveDeviceData103 e ' + e);
expect(null).assertFail();
done();
}
})
......
......@@ -1987,14 +1987,14 @@ describe('deviceKvStorePromiseTest', function () {
* @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData()
* @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData() testcase 003
*/
it('testDeviceKvStoreRemoveDeviceData003', 0, async function (done) {
it('testDeviceKvStoreRemoveDeviceData003', 0, async function (done) {
console.info('testDeviceKvStoreRemoveDeviceData003');
try {
await kvStore.removeDeviceData('').then(() => {
await kvStore.removeDeviceData('').then((data) => {
console.info('testDeviceKvStoreRemoveDeviceData003 removeDeviceData success');
expect(null).assertFail();
}).catch((err) => {
console.info('testDeviceKvStoreRemoveDeviceData003 removeDeviceData fail ' + err);
expect(null).assertFail();
});
}catch(e) {
console.info('testDeviceKvStoreRemoveDeviceData003 e ' + e);
......@@ -2010,7 +2010,7 @@ describe('deviceKvStorePromiseTest', function () {
it('testDeviceKvStoreRemoveDeviceData004', 0, async function (done) {
console.info('testDeviceKvStoreRemoveDeviceData004');
try {
await kvStore.removeDeviceData(null).then((err) => {
await kvStore.removeDeviceData(null).then((data) => {
console.info('testDeviceKvStoreRemoveDeviceData004 removeDeviceData success');
expect(null).assertFail();
}).catch((err) => {
......
......@@ -1760,16 +1760,14 @@ describe('singleKvStoreCallbackTest', function () {
await kvStore.removeDeviceData('', function (err,data) {
if (err == undefined) {
console.info('testSingleKvStoreRemoveDeviceData103 removeDeviceData success');
expect(err == undefined).assertTrue();
} else {
console.info('testSingleKvStoreRemoveDeviceData103 removeDeviceData fail: ' + err);
expect(null).assertFail();
} else {
console.info('testSingleKvStoreRemoveDeviceData103 removeDeviceData fail');
}
done();
});
}catch(e) {
console.info('testSingleKvStoreRemoveDeviceData103 e ' + e);
expect(null).assertFail();
done();
}
})
......
......@@ -1956,14 +1956,14 @@ describe('singleKvStorePromiseTest', function () {
* @tc.name [JS-API8]SingleKvStoreRemoveDeviceData.
* @tc.desc Test Js Api SingleKvStoreRemoveDeviceData testcase 003
*/
it('testSingleKvStoreRemoveDeviceData003', 0, async function (done) {
it('testSingleKvStoreRemoveDeviceData003', 0, async function (done) {
console.info('testSingleKvStoreRemoveDeviceData003');
try {
await kvStore.removeDeviceData('').then(() => {
await kvStore.removeDeviceData('').then((data) => {
console.info('testSingleKvStoreRemoveDeviceData003 removeDeviceData success');
expect(null).assertFail();
}).catch((err) => {
console.info('testSingleKvStoreRemoveDeviceData003 removeDeviceData fail ' + err);
expect(null).assertFail();
});
}catch(e) {
console.info('testSingleKvStoreRemoveDeviceData003 e ' + e);
......@@ -1971,6 +1971,7 @@ describe('singleKvStorePromiseTest', function () {
done();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0400
* @tc.name [JS-API8]SingleKvStoreRemoveDeviceData.
......
......@@ -1832,66 +1832,6 @@ describe('rdbResultSetTest', function () {
console.log(TAG + "************* testBigData0001 end *************");
}
})
/**
* @tc.name big resultSet data test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0251
* @tc.desc big resultSet data test
*/
it('testBigData0002', 0, async function (done) {
console.log(TAG + "************* testBigData0002 start *************");
{
await createBigData(500);
let resultSet = await rdbStore.querySql("SELECT * FROM test");
let count = resultSet.rowCount;
expect(500).assertEqual(count);
resultSet.goToLastRow();
let i = resultSet.rowCount;
while (i >= 1) {
expect("test" + --i).assertEqual(resultSet.getString(1))
resultSet.goToPreviousRow();
}
resultSet.close()
expect(true).assertEqual(resultSet.isClosed)
resultSet = null;
done();
console.log(TAG + "************* testBigData0002 end *************");
}
})
/**
* @tc.name big resultSet data test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0252
* @tc.desc big resultSet data test
*/
it('testBigData0003', 0, async function (done) {
console.log(TAG + "************* testBigData0003 start *************");
{
await createBigData(1);
let resultSet = await rdbStore.querySql("SELECT * FROM test");
let count = resultSet.rowCount;
expect(1).assertEqual(count);
resultSet.goToFirstRow();
expect(true).assertEqual(resultSet.isStarted);
expect("test0").assertEqual(resultSet.getString(1))
let rows = [1, 2, -1, -2];
for (const i of rows) {
resultSet.goToRow(i);
expect(true).assertEqual(resultSet.isStarted);
expect("").assertEqual(resultSet.getString(1))
}
resultSet.close()
expect(true).assertEqual(resultSet.isClosed)
resultSet = null;
done();
console.log(TAG + "************* testBigData0003 end *************");
}
})
console.info(TAG + '*************Unit Test End*************');
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册