未验证 提交 8780f1fc 编写于 作者: O openharmony_ci 提交者: Gitee

!5887 【Distributeddatamgr】【OpenHarmony-3.1-Release】RdbstoreUpdateJsunit.test.js文件修改,优化用例

Merge pull request !5887 from yanglifeng/OpenHarmony-3.1-Release
...@@ -37,7 +37,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -37,7 +37,7 @@ describe('rdbStoreUpdateTest', function () {
console.info(TAG + 'afterEach') console.info(TAG + 'afterEach')
await rdbStore.executeSql("DELETE FROM test"); await rdbStore.executeSql("DELETE FROM test");
rdbStore = null rdbStore = null
await dataRdb.deleteRdbStore("Delete.db"); await dataRdb.deleteRdbStore("UpdataTest.db");
}) })
afterAll(async function () { afterAll(async function () {
...@@ -79,9 +79,9 @@ describe('rdbStoreUpdateTest', function () { ...@@ -79,9 +79,9 @@ describe('rdbStoreUpdateTest', function () {
"blobType": u8, "blobType": u8,
} }
let predicates = await new dataRdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
await predicates.equalTo("id", "1") predicates.equalTo("id", "1")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { await updatePromise.then(async (ret) => {
await expect(1).assertEqual(ret); await expect(1).assertEqual(ret);
await console.log(TAG + "update done: " + ret); await console.log(TAG + "update done: " + ret);
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
...@@ -93,15 +93,15 @@ describe('rdbStoreUpdateTest', function () { ...@@ -93,15 +93,15 @@ describe('rdbStoreUpdateTest', function () {
const salary = await resultSet.getDouble(resultSet.getColumnIndex("salary")) const salary = await resultSet.getDouble(resultSet.getColumnIndex("salary"))
const blobType = await resultSet.getBlob(resultSet.getColumnIndex("blobType")) const blobType = await resultSet.getBlob(resultSet.getColumnIndex("blobType"))
await expect(1).assertEqual(id); expect(1).assertEqual(id);
await expect("lisi").assertEqual(name); expect("lisi").assertEqual(name);
await expect(20).assertEqual(age); expect(20).assertEqual(age);
await expect(200.5).assertEqual(salary); expect(200.5).assertEqual(salary);
await expect(4).assertEqual(blobType[0]); expect(4).assertEqual(blobType[0]);
await expect(5).assertEqual(blobType[1]); expect(5).assertEqual(blobType[1]);
await expect(6).assertEqual(blobType[2]); expect(6).assertEqual(blobType[2]);
console.log(TAG + "{id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType); console.log(TAG + "{id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType);
await expect(false).assertEqual(resultSet.goToNextRow()) expect(false).assertEqual(resultSet.goToNextRow())
resultSet = null resultSet = null
}).catch((err) => { }).catch((err) => {
console.log(TAG + "update error"); console.log(TAG + "update error");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册