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

!6977 【Distributeddatamgr】【master】分布式对象save以及revokeSave用例优化修改

Merge pull request !6977 from wangxiaomeng/master
/* /*
* Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -336,7 +336,6 @@ export default function objectStoreTest() { ...@@ -336,7 +336,6 @@ export default function objectStoreTest() {
objectTest.name = "jack1"; objectTest.name = "jack1";
objectTest.age = 19; objectTest.age = 19;
objectTest.isVis = true; objectTest.isVis = true;
expect(objectTest.name == "jack1").assertEqual(true);
expect(objectTest.age == 19).assertEqual(true); expect(objectTest.age == 19).assertEqual(true);
console.info(TAG + " set data success!"); console.info(TAG + " set data success!");
} else { } else {
...@@ -717,74 +716,135 @@ export default function objectStoreTest() { ...@@ -717,74 +716,135 @@ export default function objectStoreTest() {
console.log(TAG + "************* testPerformance001 end *************"); console.log(TAG + "************* testPerformance001 end *************");
complexObject.setSessionId(""); complexObject.setSessionId("");
}) })
/** /**
* @tc.name: testSave001 * @tc.name: testSave001
* @tc.desc: Save object <Promise> * @tc.desc: Save object <Promise>
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Save_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api_Save_001
*/ */
it('testSave001', 0, async function (done) { it('testSave001', 0, async function (done) {
console.info(TAG + "************* testSave001 start *************"); console.info(TAG + "************* testSave001 start *************");
var gObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false });
gObject.setSessionId("tmpsession01");
let result = await gObject.save("local");
done();
expect(result.sessionId == "tmpsession01").assertEqual(true);
expect(result.version == gObject.__version).assertEqual(true);
expect(result.deviceId == "local").assertEqual(true);
gObject.setSessionId("");
gObject.name = undefined;
gObject.age = undefined;
gObject.isVis = undefined;
gObject.setSessionId("tmpsession01");
expect(gObject.name == "Amy").assertEqual(true);
expect(gObject.age == 18).assertEqual(true);
expect(gObject.isVis == false).assertEqual(true);
done();
console.info(TAG + "************* testSave001 end *************");
})
/** var gObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false });
* @tc.name: testSave002 gObject.setSessionId("tmpsession01");
* @tc.desc: Save object let result = await gObject.save("local");
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Save_002 done();
*/ expect(result.sessionId == "tmpsession01").assertEqual(true);
it('testSave002', 0, function (done) { expect(result.version == gObject.__version).assertEqual(true);
console.info(TAG + "************* testSave002 start *************"); expect(result.deviceId == "local").assertEqual(true);
var objectTest = distributedObject.createDistributedObject({ name: "Eva", age: 20, isVis: false });
objectTest.setSessionId("tmpsession02"); gObject.setSessionId("");
done(); gObject.name = undefined;
console.info(TAG + "************* testSave002 end *************"); gObject.age = undefined;
gObject.isVis = undefined;
gObject.setSessionId("tmpsession01");
expect(gObject.name == "Amy").assertEqual(true);
expect(gObject.age == 18).assertEqual(true);
expect(gObject.isVis == false).assertEqual(true);
gObject.setSessionId("");
done();
console.info(TAG + "************* testSave001 end *************");
})
/**
* @tc.name: testSave002
* @tc.desc: Save object
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Save_002
*/
it('testSave002', 0, function (done) {
console.info(TAG + "************* testSave002 start *************");
var gObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false });
if (gObject != undefined && gObject != null) {
gObject.setSessionId("tmpsession02");
console.info(TAG + "testSave002 joinSession tmpsession02 success:"+ gObject.__sessionId);
}
gObject.save("local", (result) => {
console.info("save callback");
expect(result.sessionId == "tmpsession02").assertEqual(true);
expect(result.version == gObject.__version).assertEqual(true);
expect(result.deviceId == "local").assertEqual(true);
console.info("save end");
console.info("save success");
gObject.setSessionId("");
gObject.name = undefined;
gObject.age = undefined;
gObject.isVis = undefined;
console.info("save setSessionId");
gObject.setSessionId("tmpsession02");
expect(gObject.name == "Amy").assertEqual(true);
expect(gObject.age == 18).assertEqual(true);
expect(gObject.isVis == false).assertEqual(true);
}) gObject.setSessionId("");
/** });
* @tc.name: testRevokeSave001 done();
* @tc.desc: Revoke save object <Promise> console.info(TAG + "************* testSave002 end *************");
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_RevokeSave_001 })
*/
it('testRevokeSave001', 0, async function (done) { /**
console.info(TAG + "************* testRevokeSave001 start *************"); * @tc.name: testRevokeSave001
var gObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false }); * @tc.desc: Revoke save object <Promise>
gObject.setSessionId("tmpsession03"); * @tc.number: SUB_DDM_AppDataFWK_Object_Api_RevokeSave_001
done(); */
console.info(TAG + "************* testRevokeSave001 end *************"); it('testRevokeSave001', 0, async function (done) {
}) console.info(TAG + "************* testRevokeSave001 start *************");
var RObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false });
RObject.setSessionId("tmpsession03");
expect("tmpsession03" == RObject.__sessionId).assertEqual(true);
let result = await RObject.save("local");
done();
expect(result.sessionId == "tmpsession03").assertEqual(true);
expect(result.version == RObject.__version).assertEqual(true);
expect(result.deviceId == "local").assertEqual(true);
result = await RObject.revokeSave();
RObject.setSessionId("");
RObject.name = undefined;
RObject.age = undefined;
RObject.isVis = undefined;
RObject.setSessionId("tmpsession03");
expect(RObject.name == "Amy").assertEqual(false);
expect(RObject.age == 18).assertEqual(false);
expect(RObject.isVis == false).assertEqual(false);
RObject.setSessionId("");
done();
console.info(TAG + "************* testRevokeSave001 end *************");
})
/** /**
* @tc.name: testRevokeSave002 * @tc.name: testRevokeSave002
* @tc.desc: Revoke save object <Callback> * @tc.desc: Revoke save object <Callback>
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_RevokeSave_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api_RevokeSave_002
*/ */
it('testRevokeSave002', 0, async function (done) { it('testRevokeSave002', 0, async function (done) {
console.info(TAG + "************* testRevokeSave002 start *************"); console.info(TAG + "************* testRevokeSave002 start *************");
var gObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false }); var RObject = distributedObject.createDistributedObject({ name: "Amy", age: 18, isVis: false });
gObject.setSessionId("tmpsession04"); RObject.setSessionId("tmpsession04");
done(); expect("tmpsession04" == RObject.__sessionId).assertEqual(true);
console.info(TAG + "************* testRevokeSave002 end *************"); let result = await RObject.save("local");
}) done();
RObject.revokeSave((response)=>{
console.info(TAG +"revokeSave callback");
console.info("revokeSave sessionId: " + response.sessionId);
console.info(TAG +"revokeSave end");
RObject.setSessionId("");
RObject.name = undefined;
RObject.age = undefined;
RObject.isVis = undefined;
RObject.setSessionId("tmpsession04");
expect(RObject.name == "Amy").assertEqual(false);
expect(RObject.age == 18).assertEqual(false);
expect(RObject.isVis == false).assertEqual(false);
RObject.setSessionId("");
});
done();
console.info(TAG + "************* testRevokeSave002 end *************");
})
console.info(TAG + "*************Unit Test End*************"); console.info(TAG + "*************Unit Test End*************");
}) })
} }
\ No newline at end of file
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index'; import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from '@ohos/hypium';
import distributedObject from '@ohos.data.distributedDataObject'; import distributedObject from '@ohos.data.distributedDataObject';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
import bundle from '@ohos.bundle'; import bundle from '@ohos.bundle';
var context; let context;
const TAG = "OBJECTSTORE_TEST"; const TAG = "OBJECTSTORE_TEST";
function changeCallback(sessionId, changeData) { function changeCallback(sessionId, changeData) {
console.info("changeCallback start"); console.info("changeCallback start");
...@@ -83,7 +83,7 @@ describe('objectStoreTest', function () { ...@@ -83,7 +83,7 @@ describe('objectStoreTest', function () {
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_001
* @tc.type: FUNC * @tc.type: FUNC
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_001', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_001', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_001 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_001 start *************");
var g_object; var g_object;
try { try {
...@@ -112,6 +112,7 @@ describe('objectStoreTest', function () { ...@@ -112,6 +112,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId((error, data) => { g_object.setSessionId((error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -120,7 +121,7 @@ describe('objectStoreTest', function () { ...@@ -120,7 +121,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_002
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_002', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_002', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_002 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_002 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -139,6 +140,7 @@ describe('objectStoreTest', function () { ...@@ -139,6 +140,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId((error, data) => { g_object.setSessionId((error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -147,7 +149,7 @@ describe('objectStoreTest', function () { ...@@ -147,7 +149,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_003 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_003
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_003', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_003', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_003 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_003 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -163,6 +165,7 @@ describe('objectStoreTest', function () { ...@@ -163,6 +165,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId((error, data) => { g_object.setSessionId((error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -171,7 +174,7 @@ describe('objectStoreTest', function () { ...@@ -171,7 +174,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_004 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_004
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_004', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_004', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_004 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_004 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -185,6 +188,7 @@ describe('objectStoreTest', function () { ...@@ -185,6 +188,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId((error, data) => { g_object.setSessionId((error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -193,7 +197,7 @@ describe('objectStoreTest', function () { ...@@ -193,7 +197,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_005 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_005
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_005', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_005', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_005 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_SetSessionId_005 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -218,6 +222,7 @@ describe('objectStoreTest', function () { ...@@ -218,6 +222,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId("", (error, data) => { g_object.setSessionId("", (error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
...@@ -227,7 +232,7 @@ describe('objectStoreTest', function () { ...@@ -227,7 +232,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_On_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_On_001
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_On_001', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_On_001', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_On_001 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_On_001 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -263,6 +268,7 @@ describe('objectStoreTest', function () { ...@@ -263,6 +268,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId("", (error, data) => { g_object.setSessionId("", (error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -271,7 +277,7 @@ describe('objectStoreTest', function () { ...@@ -271,7 +277,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_On_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_On_002
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_On_002', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_On_002', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_On_002 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_On_002 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -298,6 +304,7 @@ describe('objectStoreTest', function () { ...@@ -298,6 +304,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId("", (error, data) => { g_object.setSessionId("", (error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -306,7 +313,7 @@ describe('objectStoreTest', function () { ...@@ -306,7 +313,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_On_003 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_On_003
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_On_003', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_On_003', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_On_003 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_On_003 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -334,6 +341,7 @@ describe('objectStoreTest', function () { ...@@ -334,6 +341,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId("", (error, data) => { g_object.setSessionId("", (error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -342,7 +350,7 @@ describe('objectStoreTest', function () { ...@@ -342,7 +350,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Off_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Off_001
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_Off_001', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_Off_001', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Off_001 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Off_001 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -381,6 +389,7 @@ describe('objectStoreTest', function () { ...@@ -381,6 +389,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId((error, data) => { g_object.setSessionId((error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -389,7 +398,7 @@ describe('objectStoreTest', function () { ...@@ -389,7 +398,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Off_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Off_002
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_Off_002', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_Off_002', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Off_002 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Off_002 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -413,6 +422,7 @@ describe('objectStoreTest', function () { ...@@ -413,6 +422,7 @@ describe('objectStoreTest', function () {
}).catch((error) => { }).catch((error) => {
console.info(TAG + error.code + error.message); console.info(TAG + error.code + error.message);
}); });
done();
}) })
/** /**
...@@ -421,7 +431,7 @@ describe('objectStoreTest', function () { ...@@ -421,7 +431,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_OnStatus_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_OnStatus_001
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_OnStatus_001', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_OnStatus_001', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_OnStatus_001 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_OnStatus_001 start *************");
console.log(TAG + "start watch status"); console.log(TAG + "start watch status");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
...@@ -440,6 +450,7 @@ describe('objectStoreTest', function () { ...@@ -440,6 +450,7 @@ describe('objectStoreTest', function () {
}).catch((error) => { }).catch((error) => {
console.info(TAG + error.code + error.message); console.info(TAG + error.code + error.message);
}); });
done();
}) })
/** /**
...@@ -448,7 +459,7 @@ describe('objectStoreTest', function () { ...@@ -448,7 +459,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_OnStatus_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_OnStatus_002
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_OnStatus_002', 0, function () { it('SUB_DDM_AppDataFWK_Object_Api9_OnStatus_002', 0, function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_OnStatus_002 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_OnStatus_002 start *************");
console.log(TAG + "start watch status"); console.log(TAG + "start watch status");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
...@@ -465,6 +476,7 @@ describe('objectStoreTest', function () { ...@@ -465,6 +476,7 @@ describe('objectStoreTest', function () {
}).catch((error) => { }).catch((error) => {
console.info(TAG + error.code + error.message); console.info(TAG + error.code + error.message);
}); });
done();
}) })
/** /**
...@@ -473,7 +485,7 @@ describe('objectStoreTest', function () { ...@@ -473,7 +485,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Save_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Save_001
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_Save_001', 0, async function () { it('SUB_DDM_AppDataFWK_Object_Api9_Save_001', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Save_001 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Save_001 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -511,6 +523,7 @@ describe('objectStoreTest', function () { ...@@ -511,6 +523,7 @@ describe('objectStoreTest', function () {
}).catch((error) => { }).catch((error) => {
console.info(TAG + error.code + error.message); console.info(TAG + error.code + error.message);
}); });
done();
}) })
/** /**
...@@ -519,7 +532,7 @@ describe('objectStoreTest', function () { ...@@ -519,7 +532,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Save_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_Save_002
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_Save_002', 0, async function () { it('SUB_DDM_AppDataFWK_Object_Api9_Save_002', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Save_002 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_Save_002 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -559,6 +572,7 @@ describe('objectStoreTest', function () { ...@@ -559,6 +572,7 @@ describe('objectStoreTest', function () {
}).catch((error) => { }).catch((error) => {
console.info(TAG + error.code + error.message); console.info(TAG + error.code + error.message);
}); });
done();
}) })
/** /**
...@@ -567,7 +581,7 @@ describe('objectStoreTest', function () { ...@@ -567,7 +581,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_001 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_001
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_001', 0, async function () { it('SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_001', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_001 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_001 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -605,6 +619,7 @@ describe('objectStoreTest', function () { ...@@ -605,6 +619,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId("", (error, data) => { g_object.setSessionId("", (error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
/** /**
...@@ -613,7 +628,7 @@ describe('objectStoreTest', function () { ...@@ -613,7 +628,7 @@ describe('objectStoreTest', function () {
* @tc.type: FUNC * @tc.type: FUNC
* @tc.number: SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_002 * @tc.number: SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_002
*/ */
it('SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_002', 0, async function () { it('SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_002', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_002 start *************"); console.log(TAG + "************* SUB_DDM_AppDataFWK_Object_Api9_RevokeSave_002 start *************");
var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false}); var g_object = distributedObject.create(context, {name: "Amy", age: 18, isVis: false});
expect(g_object == undefined).assertEqual(false); expect(g_object == undefined).assertEqual(false);
...@@ -642,6 +657,7 @@ describe('objectStoreTest', function () { ...@@ -642,6 +657,7 @@ describe('objectStoreTest', function () {
g_object.setSessionId("", (error, data) => { g_object.setSessionId("", (error, data) => {
console.info(TAG + error + "," + data); console.info(TAG + error + "," + data);
}); });
done();
}) })
console.log(TAG + "*************Unit Test End*************"); console.log(TAG + "*************Unit Test End*************");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册