提交 1fc5354c 编写于 作者: Z zhangmaowen

<zhangmaowen@huawei.com>

Signed-off-by: Nzhangmaowen <zhangmaowen@huawei.com>
上级 73dbcff8
......@@ -14,8 +14,7 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import dataRdb from '@ohos.data.rdb';
import dataAbility from '@ohos.data.dataability';
import featureAbility from '@ohos.ability.featureAbility';
import dataAbility from '@ohos.data.dataAbility';
const TAG = "[RDB_JSKITS _TEST]"
const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType "
......@@ -31,14 +30,12 @@ const STORE_CONFIG = {
name: "Predicates.db",
}
var rdbStore = undefined;
var context = undefined;
var DOUBLE_MAX = 9223372036854775807;
describe('dataAbilityPredicatesTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
context = await featureAbility.getContext();
rdbStore = await dataRdb.getRdbStore(context, STORE_CONFIG, 1);
rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_ALL_DATA_TYPE_SQL, null);
await buildAllDataType1();
await buildAllDataType2();
......@@ -56,7 +53,7 @@ describe('dataAbilityPredicatesTest', function () {
afterAll(async function () {
console.info(TAG + 'afterAll')
rdbStore = null
await dataRdb.deleteRdbStore(context, "Predicates.db");
await dataRdb.deleteRdbStore("Predicates.db");
})
function resultSize(resultSet) {
......
......@@ -13,8 +13,7 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import data_rdb from '@ohos.data.rdb'
import ability_featureAbility from '@ohos.ability.featureAbility';
import dataRdb from '@ohos.data.rdb'
const TAG = "[RDB_JSKITS_TEST]"
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "data1 text," + "data2 long, " + "data3 double," + "data4 blob)";
......@@ -23,13 +22,11 @@ const STORE_CONFIG = {
name: "Resultset.db",
}
var rdbStore = undefined;
var context = undefined;
describe('rdbResultSetTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext();
rdbStore = await data_rdb.getRdbStore(context, STORE_CONFIG, 1);
rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null);
await createTest();
})
......@@ -45,7 +42,7 @@ describe('rdbResultSetTest', function () {
afterAll(async function () {
console.info(TAG + 'afterAll')
rdbStore = null
await data_rdb.deleteRdbStore(context, "Resultset.db");
await dataRdb.deleteRdbStore("Resultset.db");
})
//插入数据
async function createTest() {
......@@ -90,7 +87,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetBlob0001', 0, async function (done) {
console.log(TAG + "************* testGetBlob0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
{
......@@ -119,7 +116,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetBlob0002', 0, async function (done) {
console.log(TAG + "************* testGetBlob0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
{
......@@ -149,7 +146,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetBlob0003', 0, async function (done) {
console.log(TAG + "************* testGetBlob0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
{
......@@ -159,7 +156,7 @@ describe('rdbResultSetTest', function () {
const id = resultSet.getLong(resultSet.getColumnIndex("id"))
const data4 = resultSet.getBlob(resultSet.getColumnIndex("data4"))
console.log(TAG + "id=" + id + ", data4=" + data4);
expect("").assertEqual(data4);
expect(0).assertEqual(data4.length);
}
resultSet.close();
expect(true).assertEqual(resultSet.isClosed)
......@@ -178,7 +175,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsStarted0001', 0, async function (done) {
console.log(TAG + "************* testIsStarted0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(false).assertEqual(resultSet.isStarted)
......@@ -197,7 +194,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsStarted0002', 0, async function (done) {
console.log(TAG + "************* testIsStarted0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
resultSet.goTo(1)
......@@ -217,7 +214,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsStarted0003', 0, async function (done) {
console.log(TAG + "************* testIsStarted0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(true).assertEqual(resultSet.goToNextRow())
......@@ -239,7 +236,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsStarted0004', 0, async function (done) {
console.log(TAG + "************* testIsStarted0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(true).assertEqual(resultSet.goToNextRow())
......@@ -261,7 +258,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsEnded0001', 0, async function (done) {
console.log(TAG + "************* testIsEnded0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -281,7 +278,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsEnded0002', 0, async function (done) {
console.log(TAG + "************* testIsEnded0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -301,7 +298,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsEnded0003', 0, async function (done) {
console.log(TAG + "************* testIsEnded0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
resultSet.goToRow(3)
......@@ -321,7 +318,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsEnded0004', 0, async function (done) {
console.log(TAG + "************* testIsEnded0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
resultSet.goToRow(3)
......@@ -342,7 +339,7 @@ describe('rdbResultSetTest', function () {
*/
it('testRowCount0001', 0, async function (done) {
console.log(TAG + "************* testRowCount0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(3).assertEqual(resultSet.rowCount)
......@@ -361,7 +358,7 @@ describe('rdbResultSetTest', function () {
*/
it('testRowCount0002', 0, async function (done) {
console.log(TAG + "************* testRowCount0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
try {
......@@ -381,7 +378,7 @@ describe('rdbResultSetTest', function () {
*/
it('testRowCount0003', 0, async function (done) {
console.log(TAG + "************* testRowCount0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("data1", "hello");
let resultSet = await rdbStore.query(predicates)
try {
......@@ -401,7 +398,7 @@ describe('rdbResultSetTest', function () {
*/
it('testRowCount0004', 0, async function (done) {
console.log(TAG + "************* testRowCount0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("data1", "hello");
predicates.equalTo("data2", 3);
let resultSet = await rdbStore.query(predicates)
......@@ -422,7 +419,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetLong0001', 0, async function (done) {
console.log(TAG + "************* testGetLong0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
{
......@@ -449,7 +446,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetLong0002', 0, async function (done) {
console.log(TAG + "************* testGetLong0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
{
......@@ -475,7 +472,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetLong0003', 0, async function (done) {
console.log(TAG + "************* testGetLong0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
{
......@@ -501,7 +498,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetString0001', 0, async function (done) {
console.log(TAG + "************* testGetString0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -520,7 +517,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetString0002', 0, async function (done) {
console.log(TAG + "************* testGetString0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -539,7 +536,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetString0003', 0, async function (done) {
console.log(TAG + "************* testGetString0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -559,7 +556,7 @@ describe('rdbResultSetTest', function () {
*/
it('testGetString0004', 0, async function (done) {
console.log(TAG + "************* testGetString0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -584,7 +581,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsClosed0001', 0, async function (done) {
console.log(TAG + "************* testIsClosed0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect(3).assertEqual(resultSet.rowCount)
......@@ -603,7 +600,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsClosed0002', 0, async function (done) {
console.log(TAG + "************* testIsClosed0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect(false).assertEqual(resultSet.isClosed)
......@@ -619,7 +616,7 @@ describe('rdbResultSetTest', function () {
*/
it('testIsClosed0003', 0, async function (done) {
console.log(TAG + "************* testIsClosed0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
expect(false).assertEqual(resultSet.isClosed)
......@@ -637,7 +634,7 @@ describe('rdbResultSetTest', function () {
it('testColumnCount0001', 0, async function (done) {
console.log(TAG + "************* testColumnCount0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect(5).assertEqual(resultSet.columnCount);
resultSet = null;
......@@ -654,7 +651,7 @@ describe('rdbResultSetTest', function () {
it('testColumnCount0002', 0, async function (done) {
console.log(TAG + "************* testColumnCount0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
expect(0).assertEqual(resultSet.columnCount);
......@@ -672,7 +669,7 @@ describe('rdbResultSetTest', function () {
it('testRowIndex0001', 0, async function (done) {
console.log(TAG + "************* testRowIndex0001 *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -693,7 +690,7 @@ describe('rdbResultSetTest', function () {
it('testRowIndex0002', 0, async function (done) {
console.log(TAG + "************* testRowIndex0002 *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -714,7 +711,7 @@ describe('rdbResultSetTest', function () {
it('testGoToFirstRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToFirstRow0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -735,7 +732,7 @@ describe('rdbResultSetTest', function () {
it('testGoToFirstRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToFirstRow0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
try {
......@@ -756,7 +753,7 @@ describe('rdbResultSetTest', function () {
it('testGoToFirstRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToFirstRow0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -778,7 +775,7 @@ describe('rdbResultSetTest', function () {
it('testGoToLastRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToLastRow0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -797,7 +794,7 @@ describe('rdbResultSetTest', function () {
it('testGoToLastRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToLastRow0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -817,7 +814,7 @@ describe('rdbResultSetTest', function () {
it('testGoToLastRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToLastRow0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -838,7 +835,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToNextRow())
......@@ -857,7 +854,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -877,7 +874,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -899,7 +896,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0004', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -919,7 +916,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(false).assertEqual(resultSet.goToPreviousRow())
......@@ -938,7 +935,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -958,7 +955,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -979,7 +976,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0004', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -999,7 +996,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0001', 0, async function (done) {
console.log(TAG + "************* testGoTo0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1020,7 +1017,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0002', 0, async function (done) {
console.log(TAG + "************* testGoTo0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -1041,7 +1038,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0003', 0, async function (done) {
console.log(TAG + "************* testGoTo0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1063,7 +1060,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0004', 0, async function (done) {
console.log(TAG + "************* testGoTo0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -1084,7 +1081,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToRow0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1105,7 +1102,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToRow0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -1126,7 +1123,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToRow0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1149,7 +1146,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0004', 0, async function (done) {
console.log(TAG + "************* testGoToRow0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -1170,7 +1167,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0001', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1190,7 +1187,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0002', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -1210,7 +1207,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0003', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1231,7 +1228,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0004', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -1251,7 +1248,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0005', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0005 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goTo(1)
......@@ -1272,7 +1269,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0006', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0006 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goTo(1)
......@@ -1293,7 +1290,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0001', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1313,7 +1310,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0002', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
{
......@@ -1333,7 +1330,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0003', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1354,7 +1351,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0004', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToLastRow())
......@@ -1374,7 +1371,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0005', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0005 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goToRow(2)
......@@ -1395,7 +1392,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0001', 0, async function (done) {
console.log(TAG + "************* testGetDouble0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goTo(1)
......@@ -1416,7 +1413,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0002', 0, async function (done) {
console.log(TAG + "************* testGetDouble0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goTo(2)
......@@ -1437,7 +1434,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0003', 0, async function (done) {
console.log(TAG + "************* testGetDouble0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goTo(3)
......@@ -1458,7 +1455,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0004', 0, async function (done) {
console.log(TAG + "************* testGetDouble0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goTo(1)
......@@ -1479,7 +1476,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0001', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1502,7 +1499,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0002', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -1525,7 +1522,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0003', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goToRow(5)
......@@ -1544,7 +1541,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0004', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
{
resultSet.goToRow(2)
......@@ -1564,7 +1561,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0001', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect(true).assertEqual(resultSet.goToFirstRow())
expect(1).assertEqual(resultSet.getColumnIndex("data1"))
......@@ -1583,7 +1580,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0002', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
expect(-1).assertEqual(resultSet.getColumnIndex("data1"))
......@@ -1602,7 +1599,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0003', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect(-1).assertEqual(resultSet.getColumnIndex("dataX"))
......@@ -1620,7 +1617,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0004', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect(-1).assertEqual(resultSet.getColumnIndex(""))
......@@ -1638,7 +1635,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0001', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect("data1").assertEqual(resultSet.getColumnName(1))
......@@ -1658,7 +1655,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0002', 0, async function (done) {
console.log(TAG + "************* testGetColumnName0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
......@@ -1679,7 +1676,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0003', 0, async function (done) {
console.log(TAG + "************* testGetColumnName0003 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
expect("").assertEqual(resultSet.getColumnName(10))
......@@ -1698,7 +1695,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0004', 0, async function (done) {
console.log(TAG + "************* testGetColumnName0004 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
......@@ -1718,7 +1715,7 @@ describe('rdbResultSetTest', function () {
it('testClose0001', 0, async function (done) {
console.log(TAG + "************* testClose0001 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
resultSet.goToRow(1)
resultSet.close()
......@@ -1738,7 +1735,7 @@ describe('rdbResultSetTest', function () {
it('testClose0002', 0, async function (done) {
console.log(TAG + "************* testClose0002 start *************");
{
let predicates = await new data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates)
resultSet.close()
......
......@@ -13,8 +13,7 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
import dataRdb from '@ohos.data.rdb';
const TAG = "[RDB_JSKITS_TEST]"
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
......@@ -23,7 +22,6 @@ const STORE_CONFIG = {
name: "Delete.db",
}
var rdbStore = undefined;
var context = undefined;
describe('rdbStoreDeleteTest', function () {
beforeAll(function () {
......@@ -32,8 +30,7 @@ describe('rdbStoreDeleteTest', function () {
beforeEach(async function () {
console.info(TAG + 'beforeEach')
context = await ability_featureAbility.getContext();
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null);
})
......@@ -41,7 +38,7 @@ describe('rdbStoreDeleteTest', function () {
console.info(TAG + 'afterEach')
await rdbStore.executeSql("DELETE FROM test");
rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "Delete.db");
await dataRdb.deleteRdbStore("Delete.db");
})
afterAll(async function () {
......@@ -86,7 +83,7 @@ describe('rdbStoreDeleteTest', function () {
}
//删除
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => {
expect(3).assertEqual(ret)
......@@ -137,7 +134,7 @@ describe('rdbStoreDeleteTest', function () {
}
//删除
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "zhangsan")
let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => {
......@@ -180,14 +177,14 @@ describe('rdbStoreDeleteTest', function () {
}
//删除前查询
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("age", 28)
let resultSet = await rdbStore.query(predicates)
expect(1).assertEqual(resultSet.rowCount)
}
//删除
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("age", 28)
let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => {
......@@ -200,7 +197,7 @@ describe('rdbStoreDeleteTest', function () {
}
//删除后查询
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("age", 28)
let resultSet = await rdbStore.query(predicates)
expect(0).assertEqual(resultSet.rowCount)
......@@ -246,7 +243,7 @@ describe('rdbStoreDeleteTest', function () {
}
//删除
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("aaa id", 1)
let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => {
......@@ -297,7 +294,7 @@ describe('rdbStoreDeleteTest', function () {
}
//删除
{
let predicates = await new ohos_data_rdb.RdbPredicates("test")
let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "lisi")
let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => {
......@@ -349,7 +346,7 @@ describe('rdbStoreDeleteTest', function () {
}
//删除
{
let predicates = await new ohos_data_rdb.RdbPredicates("")
let predicates = await new dataRdb.RdbPredicates("")
let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => {
console.log(TAG + "delete done: " + ret)
......
......@@ -14,8 +14,7 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
import dataRdb from '@ohos.data.rdb';
const TAG = "[RDB_JSKITS_TEST]"
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
......@@ -25,13 +24,11 @@ const STORE_CONFIG = {
}
var rdbStore = undefined;
var context = undefined;
describe('rdbStoreInsertTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext();
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null);
})
......@@ -47,7 +44,7 @@ describe('rdbStoreInsertTest', function () {
afterAll(async function () {
console.info(TAG + 'afterAll')
rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "InsertTest.db");
await dataRdb.deleteRdbStore("InsertTest.db");
})
console.log(TAG + "*************Unit Test Begin*************");
......@@ -88,7 +85,7 @@ describe('rdbStoreInsertTest', function () {
await rdbStore.insert("test", valueBucket)
}
let predicates = new ohos_data_rdb.RdbPredicates("test");
let predicates = new dataRdb.RdbPredicates("test");
predicates.equalTo("name", "zhangsan")
let resultSet = await rdbStore.query(predicates)
try {
......
......@@ -110,8 +110,8 @@ describe('storageTest', function () {
}
try {
perf.putSync("int", 3);
expect(null).assertFail();
} catch (e) {
expect(null).assertFail();
}
})
......
......@@ -50,7 +50,7 @@ describe('storageTest', function () {
* @tc.desc Constructor test
*/
it('testConstructor002', 0, function () {
expect(mPref).assertEqual('[object Object]');
expect(typeof mPref).assertEqual("object");
})
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册