未验证 提交 5c3e32cc 编写于 作者: O openharmony_ci 提交者: Gitee

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

Merge pull request !5399 from 梁梁/master
......@@ -3358,6 +3358,7 @@ export default function pasteBoardJEtsunitTest() {
console.info('f_test64 Checks there is content in the pasteboard')
systemPasteboard.hasPasteData().then((data) => {
console.info('f_test64 systemPasteboard.hasPasteData promise data = ' + data);
expect(data).assertTrue();
console.info('f_test64 Checks the number of records');
systemPasteboard.getPasteData().then((data) => {
......@@ -3365,12 +3366,14 @@ export default function pasteBoardJEtsunitTest() {
var pasteData1 = data;
var recordCount = pasteData1.getRecordCount();
console.info('f_test64 recordCount = ' + recordCount);
expect(recordCount).assertEqual(1)
console.info('f_test64 Removes the Record')
pasteData1.removeRecordAt(0)
console.info('f_test64 Checks the number of records');
var recordCount1 = pasteData1.getRecordCount();
expect(recordCount1).assertEqual(0);
console.info('f_test64 recordCount = ' + recordCount1);
console.info('SUB_pasteBoard_function_JS_API_6400 end');
......@@ -3427,7 +3430,7 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.hasPasteData().then((data) => {
console.info('f_test65 systemPasteboard.hasPasteData promise data = ' + data);
console.info('SUB_pasteBoard_function_JS_API_6400 end');
console.info('SUB_pasteBoard_function_JS_API_6500 end');
done();
});
});
......
......@@ -1908,7 +1908,13 @@ describe('dataAbilityPredicatesTest', function () {
console.info(TAG + "************* testAnd0003 start *************");
{
let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates();
var dataAbilityPredicatesInit = dataAbilityPredicates
dataAbilityPredicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1);
if(dataAbilityPredicatesInit == dataAbilityPredicates){
expect(true).assertTrue();
}else{
expect(null).assertFail();
}
let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates);
console.info(TAG + "you should not start a request" + " with \"and\" or use or() before this function");
......@@ -1926,9 +1932,14 @@ describe('dataAbilityPredicatesTest', function () {
console.info(TAG + "************* testAnd0004 start *************");
{
let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates();
var dataAbilityPredicatesInit = dataAbilityPredicates
dataAbilityPredicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().or().equalTo("integerValue", 1);
let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates);
if(dataAbilityPredicatesInit == dataAbilityPredicates){
expect(true).assertTrue();
}else{
expect(null).assertFail();
}
console.info(TAG + "you are starting a sql request with predicate or or,"
+ "using function or() immediately after another or(). that is ridiculous.");
}
......
......@@ -57,6 +57,7 @@ describe('fieldNodeTest', function() {
node = null;
} catch (e) {
console.info("testAppendChild002 " + e);
expect(null).assertFail();
}
done();
})
......
......@@ -597,12 +597,15 @@ describe('rdbstoreInsertTest', function () {
}
const valueBuckets = [valueBucket1, valueBucket2, valueBucket3]
try{
await rdbStore.batchInsert("test6","valueBuckets").catch((err) =>{
expect(err != null).assertTrue();
await rdbStore.batchInsert("test6","valueBuckets").then((number) => {
console.info(TAG + "Affect row is " + number)
expect(number).assertEqual(-1)
}).catch((err) =>{
expect(err == null).assertTrue();
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(err != null).assertTrue();
expect(err == null).assertTrue();
}
done()
console.info(TAG + "************* testRdbStorebatchInsertPromise0006 end *************");
......@@ -617,12 +620,15 @@ describe('rdbstoreInsertTest', function () {
console.info(TAG + "************* testRdbStorebatchInsertPromise0007 start *************");
await rdbStore.executeSql(CREATE_TABLE_NAME + "7" + CREATE_TABLE)
try{
await rdbStore.batchInsert("test7").catch((err) =>{
expect(err != null).assertTrue();
await rdbStore.batchInsert("test7").then((number) => {
console.info(TAG + "BatchInsert without data,affect row number is " + number)
expect(number).assertEqual(0)
}).catch((err) =>{
expect(err == null).assertTrue();
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(err != null).assertTrue();
expect(err == null).assertTrue();
}
done()
console.info(TAG + "************* testRdbStorebatchInsertPromise0007 end *************");
......@@ -1036,16 +1042,17 @@ describe('rdbstoreInsertTest', function () {
const valueBuckets = [valueBucket1, valueBucket2, valueBucket3]
await rdbStore.executeSql(CREATE_TABLE_NAME + "Callback6" + CREATE_TABLE).then(async () => {
try{
await rdbStore.batchInsert("testCallback6", "valueBuckets", (err, data) => {
rdbStore.batchInsert("testCallback6", "valueBuckets", (err, data) => {
console.info(TAG + "Affect row is " + data)
if(err != null){
expect(err != null).assertTrue()
expect(err == null).assertTrue()
}else{
expect(false).assertTrue()
expect(data).assertEqual(-1)
}
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(err != null).assertTrue();
expect(err == null).assertTrue();
}
})
......@@ -1064,14 +1071,22 @@ describe('rdbstoreInsertTest', function () {
try{
await rdbStore.executeSql(CREATE_TABLE_NAME + "Callback7" + CREATE_TABLE).then(async () => {
await rdbStore.batchInsert("testCallback7", (err,data) => {
console.info(TAG + "Affect row is " + data)
if(err != null){
expect(err != null).assertTrue();
expect(err == null).assertTrue();
}else{
expect(data).assertEqual(-1)
}
}).then((data) => {
console.info(TAG + "Batch insert fail ,affect row number is: " + data)
expect(data).assertEqual(-1)
})
}).then((err) => {
expect(err == null).assertTrue();
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(err != null).assertTrue();
expect(err == null).assertTrue();
}
done()
console.info(TAG + "************* testRdbStorebatchInsertCallback0007 end *************");
......
......@@ -1725,7 +1725,13 @@ describe('rdbPredicatesTest', function () {
console.info(TAG + "************* testAnd0003 start *************");
{
let predicates = await new dataRdb.RdbPredicates("AllDataType");
var predicatesInit = predicates
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1);
if(predicates == predicatesInit){
expect(true).assertTrue();
}else{
expect(null).assertFail();
}
console.info(TAG + "you should not start a request" + " with \"and\" or use or() before this function");
}
done();
......@@ -1741,7 +1747,13 @@ describe('rdbPredicatesTest', function () {
console.info(TAG + "************* testAnd0004 start *************");
{
let predicates = await new dataRdb.RdbPredicates("AllDataType");
var predicatesInit = predicates
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().or().equalTo("integerValue", 1);
if(predicates == predicatesInit){
expect(true).assertTrue();
}else{
expect(null).assertFail();
}
console.info(TAG + "you are starting a sql request with predicate or or,"
+ "using function or() immediately after another or(). that is ridiculous.");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册