提交 1b15cb53 编写于 作者: Y yanglifeng1217

<modified>

Signed-off-by: Nyanglifeng1217 <yanglifeng5@huawei.com>
上级 a7aaadb6
......@@ -61,6 +61,9 @@ try {
expect(null).assertFail()
}
}
function storeObserver(devices) {
console.info(TAG + devices + " dataChange");
}
export default function rdbStoreDistributedTest() {
describe('rdbStoreDistributedTest', function () {
......@@ -343,11 +346,14 @@ describe('rdbStoreDistributedTest', function () {
*/
it('testRdbStoreDistributed0012', 0, async function (done) {
console.info(TAG + "************* testRdbStoreDistributed0012 start *************");
rdbStore.on("dataChange", dataRdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, (device) => {
console.info(TAG + device + " dataChange");
});
console.info(TAG + "on dataChange success");
try{
rdbStore.on("dataChange", dataRdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver);
console.info(TAG + "on dataChange success ");
expect(rdbStore).assertEqual(rdbStore);
}catch(err){
console.info(TAG + "on dataChange " + err);
expect(err !== null).assertFalse();
}
done()
console.info(TAG + "************* testRdbStoreDistributed0012 end *************");
})
......@@ -357,13 +363,16 @@ describe('rdbStoreDistributedTest', function () {
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_013
* @tc.desc subscribe test
*/
it('testRdbStoreDistributed0013', 0, async function (done) {
it('testRdbStoreDistributed0013', 0, function (done) {
console.info(TAG + "************* testRdbStoreDistributed0013 start *************");
rdbStore.off("dataChange", dataRdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, (device) => {
console.info(TAG + device + " dataChange");
});
console.info(TAG + "off dataChange success");
try{
let off = rdbStore.on("dataChange", dataRdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver);
console.info(TAG + "off dataChange success " + off);
expect(rdbStore).assertEqual(rdbStore);
}catch(err){
console.info(TAG + "off dataChange " + err);
expect(err !== null).assertFalse();
}
done()
console.info(TAG + "************* testRdbStoreDistributed0013 end *************");
})
......
......@@ -175,12 +175,13 @@ describe('rdbEncryptTest', function () {
rdbStore = null
try {
rdbStore = await CreatRdbStore(context, STORE_CONFIG_WRONG)
expect(rdbStore !== null).assertFalse()
} catch (err) {
console.info(TAG + `catch err: ` + err)
expect(err).assertTrue
}
expect(rdbStore).assertEqual(null)
done()
console.info(TAG + "************* RdbEncryptTest_0040 end *************")
}
})
console.info(TAG + "*************Unit Test End*************")
}
......
......@@ -64,6 +64,10 @@ try {
}
}
function storeObserver(devices) {
console.info(TAG + devices + " dataChange");
}
export default function relationalStoreDistributedTest() {
describe('relationalStoreDistributedTest', function () {
beforeAll(async function () {
......@@ -345,11 +349,14 @@ describe('relationalStoreDistributedTest', function () {
*/
it('testRdbStoreDistributed0012', 0, async function (done) {
console.info(TAG + "************* testRdbStoreDistributed0012 start *************");
rdbStore.on("dataChange", data_Rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, (device) => {
console.info(TAG + device + " dataChange");
});
console.info(TAG + "on dataChange success");
try{
rdbStore.on("dataChange", data_Rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver);
console.info(TAG + "on dataChange success ");
expect(rdbStore).assertEqual(rdbStore);
}catch(err){
console.info(TAG + "on dataChange " + err);
expect(err !== null).assertFalse();
}
done()
console.info(TAG + "************* testRdbStoreDistributed0012 end *************");
})
......@@ -359,13 +366,16 @@ describe('relationalStoreDistributedTest', function () {
* @tc.number SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_013
* @tc.desc subscribe test
*/
it('testRdbStoreDistributed0013', 0, async function (done) {
it('testRdbStoreDistributed0013', 0, function (done) {
console.info(TAG + "************* testRdbStoreDistributed0013 start *************");
rdbStore.off("dataChange", data_Rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, (device) => {
console.info(TAG + device + " dataChange");
});
console.info(TAG + "off dataChange success");
try{
let off = rdbStore.on("dataChange", data_Rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver);
console.info(TAG + "off dataChange success " + off);
expect(rdbStore).assertEqual(rdbStore);
}catch(err){
console.info(TAG + "off dataChange " + err);
expect(err !== null).assertFalse();
}
done()
console.info(TAG + "************* testRdbStoreDistributed0013 end *************");
})
......
......@@ -178,13 +178,13 @@ describe('relationalStoreEncryptTest', function () {
rdbStore = null
try {
rdbStore = await CreatRdbStore(context, STORE_CONFIG_WRONG)
expect(rdbStore !== null).assertFalse()
} catch (err) {
console.info(TAG + `catch err: err.code= ${err.code}, message = ${err.message}`)
expect(err.code === 14800000).assertTrue
}
expect(err.code).assertEqual(14800000);
done()
console.info(TAG + "************* RdbEncryptTest_0040 end *************")
}
})
console.info(TAG + "*************Unit Test End*************")
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册