From d325b09d3c4b28d7d4c2be0558ada0f4cd3a4caf Mon Sep 17 00:00:00 2001 From: zhangmaowen Date: Sat, 28 May 2022 09:50:53 +0800 Subject: [PATCH] Signed-off-by: zhangmaowen --- .../test/DataAbilityPredicatesJsunit.test.js | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataAbilityPredicatesJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataAbilityPredicatesJsunit.test.js index b7da8581f..37216674c 100755 --- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataAbilityPredicatesJsunit.test.js +++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataAbilityPredicatesJsunit.test.js @@ -2365,5 +2365,73 @@ describe('dataAbilityPredicatesTest', function () { done(); console.log(TAG + "************* testNotIn0003 end *************"); }) + + /** + * @tc.name predicates in normal test + * @tc.number SUB_DDM_AppDataFWK_JSRDB_DataAbilityPredicates_0253 + * @tc.desc predicates in normal test + */ + it('testIn0001', 0, async function (done) { + console.log(TAG + "************* testIn0001 start *************"); + var values = [Number.MIN_VALUE.toString()]; + let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates(); + dataAbilityPredicates.in("doubleValue", values); + let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates); + let result = await rdbStore.query(predicates); + expect(1).assertEqual(result.rowCount); + done(); + console.log(TAG + "************* testIn0001 end *************"); + }) + + /** + * @tc.name predicates in normal test + * @tc.number SUB_DDM_AppDataFWK_JSRDB_DataAbilityPredicates_0254 + * @tc.desc predicates in normal test + */ + it('testIn0002', 0, async function (done) { + console.log(TAG + "************* testIn0002 start *************"); + var values = ["1.0"]; + let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates(); + dataAbilityPredicates.in("doubleValue", values); + let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates); + let result = await rdbStore.query(predicates); + expect(1).assertEqual(result.rowCount); + done(); + console.log(TAG + "************* testIn0002 end *************"); + }) + + /** + * @tc.name predicates in normal test + * @tc.number SUB_DDM_AppDataFWK_JSRDB_DataAbilityPredicates_0255 + * @tc.desc predicates in normal test + */ + it('testIn0003', 0, async function (done) { + console.log(TAG + "************* testIn0003 start *************"); + var values = [DOUBLE_MAX.toString()]; + let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates(); + dataAbilityPredicates.in("doubleValue", values); + let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates); + let result = await rdbStore.query(predicates); + expect(1).assertEqual(result.rowCount); + done(); + console.log(TAG + "************* testIn0003 end *************"); + }) + + /** + * @tc.name predicates in normal test + * @tc.number SUB_DDM_AppDataFWK_JSRDB_DataAbilityPredicates_0256 + * @tc.desc predicates in normal test + */ + it('testIn0004', 0, async function (done) { + console.log(TAG + "************* testIn0004 start *************"); + var values = [Number.MIN_VALUE.toString(), "1.0", DOUBLE_MAX.toString()]; + let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates(); + dataAbilityPredicates.in("doubleValue", values); + let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates); + let result = await rdbStore.query(predicates); + expect(3).assertEqual(result.rowCount); + done(); + console.log(TAG + "************* testIn0004 end *************"); + }) console.log(TAG + "*************Unit Test End*************"); }) -- GitLab