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

!3050 【XTS】【事件通知子系统】XTS整改

Merge pull request !3050 from fujiarui/OpenHarmony-3.1-Release
...@@ -16,7 +16,7 @@ group("ans_standard") { ...@@ -16,7 +16,7 @@ group("ans_standard") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"actsansnotificationcancel:ActsAnsNotificationCancelTest", #"actsansnotificationcancel:ActsAnsNotificationCancelTest",
"actsansnotificationremove:ActsAnsNotificationRemoveTest", "actsansnotificationremove:ActsAnsNotificationRemoveTest",
"actsansslottest:ActsAnsSlotTest", "actsansslottest:ActsAnsSlotTest",
"publish_test:publish_test", "publish_test:publish_test",
......
...@@ -26,14 +26,16 @@ group("publish_test") { ...@@ -26,14 +26,16 @@ group("publish_test") {
#"publishcontentype:publishcontentype", #"publishcontentype:publishcontentype",
#"subscribe:subscribe", #"subscribe:subscribe",
"activebtn:activebtn", "activebtn:activebtn",
"actsansdistributedtest:ActsAnsDistributeTest",
#"actsansdistributedtest:ActsAnsDistributeTest",
"actsansgetallactive:ActsAnsGetAllActiveTestXts", "actsansgetallactive:ActsAnsGetAllActiveTestXts",
"ansactscancelgroup:ActsAnsCancelGroupTest", "ansactscancelgroup:ActsAnsCancelGroupTest",
"ansactsremovegroup:ActsAnsRemoveGroupTest", "ansactsremovegroup:ActsAnsRemoveGroupTest",
"donotdisturbmode:ActsAnsDoNotDisturbTest", "donotdisturbmode:ActsAnsDoNotDisturbTest",
"publish:ActsAnsNotificationPublishXts", "publish:ActsAnsNotificationPublishXts",
"publishsound:ActsAnsPublishSoundTest", "publishsound:ActsAnsPublishSoundTest",
"publishvibra:ActsAnsPublishVibraTest",
#"publishvibra:ActsAnsPublishVibraTest",
"sub:ActsAnsSubTestXts", "sub:ActsAnsSubTestXts",
"unsubscribe:ActsAnsUnSubscriberTest", "unsubscribe:ActsAnsUnSubscriberTest",
"wantagent:wantagent", "wantagent:wantagent",
......
...@@ -95,342 +95,5 @@ describe('ActsAnsGetAllActiveTestXts', function () { ...@@ -95,342 +95,5 @@ describe('ActsAnsGetAllActiveTestXts', function () {
done(); done();
}, time); }, time);
}) })
/*
* @tc.number: Ans_GetAllActive_xts_0200
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>
* @tc.desc: Verify: After the current app and other apps publish two notifications,
get all active notifications in the system(promise)
*/
it('Ans_GetAllActive_xts_0200', 0, async function (done) {
console.debug("===============Ans_GetAllActive_0200 start==================>");
await notify.cancelAll();
var notificationRequestOfOtherApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_otherApp",
text: "test_text_otherApp",
additionalText: "test_additionalText_otherApp"
},
},
id: 2,
label: "otherApp",
}
await notify.publish(notificationRequestOfOtherApp);
console.debug("===============Ans_GetAllActive_0200 publish OtherApp notify end==================>");
var notificationRequestOfCurrentApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_currentApp",
text: "test_text_currentApp",
additionalText: "test_additionalText_currentApp"
},
},
id: 1,
label: "currentApp_0200",
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_0200 publish CurrentApp notify end==================>");
var promiseData = await notify.getAllActiveNotifications();
console.debug("===============Ans_GetAllActive_0200 getActiveNotifications end==================>");
expect(promiseData.length).assertEqual(2);
var i;
for (i = 0; i < promiseData.length; i++) {
if (i == 0){
expect(promiseData[i].content.normal.title).assertEqual("test_title_otherApp");
console.log("=======Ans_GetAllActive_0200 title=====>"+promiseData[i].content.normal.title)
expect(promiseData[i].content.normal.text).assertEqual("test_text_otherApp");
console.log("=======Ans_GetAllActive_0200 text========>"+promiseData[i].content.normal.text)
expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp");
console.log("===Ans_GetAllActive_0200 text====>"+promiseData[i].content.normal.additionalText)
expect(promiseData[i].id).assertEqual(2);
console.log("============Ans_GetAllActive_0200 id============>"+promiseData[i].id)
expect(promiseData[i].label).assertEqual("otherApp");
console.log("============Ans_GetAllActive_0200 label=====>"+promiseData[i].label)
}else if(i == 1){
expect(promiseData[i].content.normal.title).assertEqual("test_title_currentApp");
console.log("====Ans_GetAllActive_0200 title=====>"+promiseData[i].content.normal.title)
expect(promiseData[i].content.normal.text).assertEqual("test_text_currentApp");
console.log("======Ans_GetAllActive_0200 text=====>"+promiseData[i].content.normal.text)
expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_currentApp");
console.log("Ans_GetAllActive_0200 text===>"+promiseData[i].content.normal.additionalText)
expect(promiseData[i].id).assertEqual(1);
console.log("============Ans_GetAllActive_0200 id============>"+promiseData[i].id)
expect(promiseData[i].label).assertEqual("currentApp_0200");
console.log("============Ans_GetAllActive_0200 label=====>"+promiseData[i].label)
}
}
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0200 setTimeout==================>");
done();
}, time);
})
function getAllCallbackThree(err, data){
console.log("Ans_GetAllActive_0300 getAllCallbackThree ============>");
console.log("Ans_GetAllActive_0300 getAllCallbackThree data.length============>"+data.length);
console.log("Ans_GetAllActive_0300 getAllCallbackThree data============>"+JSON.stringify(data));
expect(data.length).assertEqual(1);
var i;
for (i = 0; i < data.length; i++) {
expect(data[i].content.normal.title).assertEqual("test_title_otherApp");
console.log("==========Ans_GetAllActive_0300 getCallback title=========>"+data[i].content.normal.title)
expect(data[i].content.normal.text).assertEqual("test_text_otherApp");
console.log("==========Ans_GetAllActive_0300 getCallback text============>"+data[i].content.normal.text)
expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp");
console.log("======Ans_GetAllActive_0300 getCallback text=======>"+data[i].content.normal.additionalText)
expect(data[i].id).assertEqual(2);
console.log("============Ans_GetAllActive_0300 getCallback id============>"+data[i].id)
expect(data[i].label).assertEqual("otherApp");
console.log("============Ans_GetAllActive_0300 getCallback label=====>"+data[i].label)
}
}
/*
* @tc.number: Ans_GetAllActive_xts_0300
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify: After the current app and other apps publish two notifications, cancel the notifications
of the current app, get all active notifications in the system(callback)
*/
it('Ans_GetAllActive_xts_0300', 0, async function (done) {
console.debug("===============Ans_GetAllActive_0300 start==================>");
await notify.cancelAll();
var notificationRequestOfOtherApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_otherApp",
text: "test_text_otherApp",
additionalText: "test_additionalText_otherApp"
},
},
id: 2,
label: "otherApp",
}
await notify.publish(notificationRequestOfOtherApp);
console.debug("===============Ans_GetAllActive_0300 publish OtherApp notify end==================>");
var notificationRequestOfCurrentApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_currentApp",
text: "test_text_currentApp",
additionalText: "test_additionalText_currentApp"
},
},
id: 1,
label: "currentApp_0300",
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_0300 publish CurrentApp notify end==================>");
await notify.cancel(1, "currentApp_0300");
notify.getAllActiveNotifications(getAllCallbackThree);
console.debug("===============Ans_GetAllActive_0300 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0300 setTimeout==================>");
done();
}, time);
})
/*
* @tc.number: Ans_GetAllActive_xts_0400
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
* @tc.desc: Verify: after publishing two notifications,
cancel one of the notifications, get all active notifications info(promise)
*/
it('Ans_GetAllActive_xts_0400', 0, async function (done) {
console.debug("===============Ans_GetAllActive_0400 start==================>");
await notify.cancelAll();
var notificationRequestOfOtherApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_otherApp",
text: "test_text_otherApp",
additionalText: "test_additionalText_otherApp"
},
},
id: 2,
label: "otherApp",
}
await notify.publish(notificationRequestOfOtherApp);
console.debug("===============Ans_GetAllActive_0400 publish OtherApp notify end==================>");
var notificationRequestOfCurrentApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_currentApp",
text: "test_text_currentApp",
additionalText: "test_additionalText_currentApp"
},
},
id: 1,
label: "currentApp_0400",
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_0400 publish CurrentApp notify end==================>");
await notify.cancel(1, "currentApp_0400");
console.debug("===============Ans_GetAllActive_0400 cancel end==================>");
var promiseData = await notify.getAllActiveNotifications();
var i;
for (i = 0; i < promiseData.length; i++) {
expect(promiseData[i].content.normal.title).assertEqual("test_title_otherApp");
console.log("=======Ans_GetAllActive_0400 title=====>"+promiseData[i].content.normal.title)
expect(promiseData[i].content.normal.text).assertEqual("test_text_otherApp");
console.log("=======Ans_GetAllActive_0400 text========>"+promiseData[i].content.normal.text)
expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp");
console.log("===Ans_GetAllActive_0400 text====>"+promiseData[i].content.normal.additionalText)
expect(promiseData[i].id).assertEqual(2);
console.log("============Ans_GetAllActive_0400 id============>"+promiseData[i].id)
expect(promiseData[i].label).assertEqual("otherApp");
console.log("============Ans_GetAllActive_0400 label=====>"+promiseData[i].label)
}
console.debug("===============Ans_GetAllActive_0400 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0400 setTimeout==================>");
done();
}, time);
})
function getAllCallbackFive(err, data){
console.log("Ans_GetAllActive_0500 getAllCallbackFive data.length============>"+data.length);
console.log("Ans_GetAllActive_0500 getAllCallbackFive data============>"+JSON.stringify(data));
expect(data.length).assertEqual(0);
}
/*
* @tc.number: Ans_GetAllActive_xts_0500
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify: After the current app and other apps publish two notifications, remove all the notifications
of the system, get all active notifications in the system(callback)
*/
it('Ans_GetAllActive_xts_0500', 0, async function (done) {
console.debug("===============Ans_GetAllActive_0500 start==================>");
await notify.cancelAll();
var notificationRequestOfOtherApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_otherApp",
text: "test_text_otherApp",
additionalText: "test_additionalText_otherApp"
},
},
id: 2,
label: "otherApp",
}
await notify.publish(notificationRequestOfOtherApp);
console.debug("===============Ans_GetAllActive_0500 publish OtherApp notify end==================>");
var notificationRequestOfCurrentApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_currentApp",
text: "test_text_currentApp",
additionalText: "test_additionalText_currentApp"
},
},
id: 1,
label: "currentApp_0500",
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_0500 publish CurrentApp notify end==================>");
await notify.removeAll();
notify.getAllActiveNotifications(getAllCallbackFive);
console.debug("===============Ans_GetAllActive_0500 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0500 setTimeout==================>");
done();
}, time);
})
/*
* @tc.number: Ans_GetAllActive_xts_0600
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
* @tc.desc: Verify: After the current app and other apps publish two notifications, remove all the notifications
of the system, get all active notifications in the system(promise)
*/
it('Ans_GetAllActive_xts_0600', 0, async function (done) {
console.debug("===============Ans_GetAllActive_0600 start==================>");
await notify.cancelAll();
var notificationRequestOfOtherApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_otherApp",
text: "test_text_otherApp",
additionalText: "test_additionalText_otherApp"
},
},
id: 2,
label: "otherApp",
}
await notify.publish(notificationRequestOfOtherApp);
console.debug("===============Ans_GetAllActive_0600 publish OtherApp notify end==================>");
var notificationRequestOfCurrentApp = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title_currentApp",
text: "test_text_currentApp",
additionalText: "test_additionalText_currentApp"
},
},
id: 1,
label: "currentApp_0600",
}
await notify.publish(notificationRequestOfCurrentApp);
console.debug("==========Ans_GetAllActive_0600 publish CurrentApp notify end==================>");
await notify.removeAll();
var promiseData = await notify.getAllActiveNotifications();
expect(promiseData.length).assertEqual(0);
console.debug("=======Ans_GetAllActive_0600 promiseData.length==========>"+promiseData.length);
console.debug("=======Ans_GetAllActive_0600 promiseData==========>"+JSON.stringify(promiseData));
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0600 setTimeout==================>");
done();
}, time);
})
function getAllCallbackSeven(err, data){
console.log("Ans_GetAllActive_0700 getAllCallbackSeven data.length============>"+data.length);
console.log("Ans_GetAllActive_0700 getAllCallbackSeven data============>"+JSON.stringify(data));
expect(data.length).assertEqual(0);
}
/*
* @tc.number: Ans_GetAllActive_xts_0700
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify:No active notifications in the system, get all active notifications in the system(callback)
*/
it('Ans_GetAllActive_xts_0700', 0, async function (done) {
console.debug("===============Ans_GetAllActive_0700 start==================>");
await notify.removeAll();
notify.getAllActiveNotifications(getAllCallbackSeven);
console.debug("===============Ans_GetAllActive_0700 getAllActiveNotifications end==================>");
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0700 setTimeout==================>");
done();
}, time);
})
/*
* @tc.number: Ans_GetAllActive_xts_0800
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
* @tc.desc: Verify: No active notifications in the system, get all active notifications in the system(promise)
*/
it('Ans_GetAllActive_xts_0800', 0, async function (done) {
console.debug("==========Ans_GetAllActive_0800 start==================>");
await notify.removeAll();
var promiseData = await notify.getAllActiveNotifications();
console.debug("=========Ans_GetAllActive_0800 promiseData.length=============>"+promiseData.length);
expect(promiseData.length).assertEqual(0);
setTimeout(function(){
console.debug("===============Ans_GetAllActive_0800 setTimeout==================>");
done();
}, time);
})
}) })
...@@ -32,22 +32,7 @@ describe('ActsAnsBadgeDisplayTest', function () { ...@@ -32,22 +32,7 @@ describe('ActsAnsBadgeDisplayTest', function () {
done(); done();
}) })
}) })
/*
* @tc.number: ActsGetDisplay_test_0200
* @tc.name: isBadgeDisplayed()
* @tc.desc: verify the function of isBadgeDisplayed
*/
it('ActsGetDisplay_test_0200', 0, async function (done) {
notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
}).then((promise)=>{
console.log("===>ActsGetDisplay_test_0200 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
done()}
).catch((err)=>{
console.log("===>ActsGetDisplay_test_0200 err===>"+err.code)
})
})
/* /*
* @tc.number: ActsGetDisplay_test_0300 * @tc.number: ActsGetDisplay_test_0300
* @tc.name: isBadgeDisplayed() * @tc.name: isBadgeDisplayed()
...@@ -122,45 +107,7 @@ describe('ActsAnsBadgeDisplayTest', function () { ...@@ -122,45 +107,7 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect(promise).assertEqual(undefined) expect(promise).assertEqual(undefined)
done(); done();
}) })
/*
* @tc.number: ActsGetDisplay_test_0900
* @tc.name: isBadgeDisplayed()
* @tc.desc: verify the function of isBadgeDisplayed
*/
it('ActsGetDisplay_test_0900', 0, async function (done) {
await notify.displayBadge({
bundle:"com.example.actsanslocalcandisplaytest"
},true,async(err) => {
console.log("===>ActsGetDisplay_test_0900 success===>"+err)
await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
},(err,data) => {
console.log("===>ActsGetDisplay_test_0900 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(true)
done();
})
})
})
/*
* @tc.number: ActsGetDisplay_test_1000
* @tc.name: isBadgeDisplayed()
* @tc.desc: verify the function of isBadgeDisplayed
*/
it('ActsGetDisplay_test_1000', 0, async function (done) {
await notify.displayBadge({
bundle:"com.example.actsanslocalcandisplaytest"
},true,async(err) => {
console.log("===>ActsGetDisplay_test_1000 success===>"+err)
var promise = await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
})
console.log("===>ActsGetDisplay_test_1000 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
})
})
/* /*
* @tc.number: ActsSetDisplay_test_0100 * @tc.number: ActsSetDisplay_test_0100
* @tc.name: displayBadge() * @tc.name: displayBadge()
...@@ -214,43 +161,7 @@ describe('ActsAnsBadgeDisplayTest', function () { ...@@ -214,43 +161,7 @@ describe('ActsAnsBadgeDisplayTest', function () {
done(); done();
}) })
}) })
/*
* @tc.number: ActsSetDisplay_test_0500
* @tc.name: displayBadge()
* @tc.desc: verify the function of displayBadge
*/
it('ActsSetDisplay_test_0500', 0, async function (done) {
await notify.displayBadge({
bundle:"com.example.actsanslocalcandisplaytest"
},true,async(err) => {
await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
},(err,data) => {
console.log("===>ActsSetDisplay_test_0500 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(true)
done();
})
})
})
/*
* @tc.number: ActsSetDisplay_test_0600
* @tc.name: displayBadge()
* @tc.desc: verify the function of displayBadge
*/
it('ActsSetDisplay_test_0600', 0, async function (done) {
await notify.displayBadge({
bundle:"com.example.actsanslocalcandisplaytest"
},true).then(async(err) => {
var promise = await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
})
console.log("===>ActsSetDisplay_test_0600 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
})
})
/* /*
* @tc.number: ActsSetDisplay_test_0700 * @tc.number: ActsSetDisplay_test_0700
* @tc.name: displayBadge() * @tc.name: displayBadge()
...@@ -270,49 +181,6 @@ describe('ActsAnsBadgeDisplayTest', function () { ...@@ -270,49 +181,6 @@ describe('ActsAnsBadgeDisplayTest', function () {
}) })
}) })
}) })
/*
* @tc.number: ActsSetDisplay_test_0800
* @tc.name: displayBadge()
* @tc.desc: verify the function of displayBadge
*/
it('ActsSetDisplay_test_0800', 0, async function (done) {
await notify.displayBadge({
bundle:"com.example.actsanslocalcandisplaytest"
},false).then(async(err) => {
var promise = await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
})
console.log("===>ActsSetDisplay_test_0800 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(false)
done();
})
})
/*
* @tc.number: ActsSetDisplay_test_0900
* @tc.name: enableNotification()
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetDisplay_test_0900', 0, async function (done) {
await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
},(err,data) => {
console.log("===>ActsSetDisplay_test_0900 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(false)
})
await notify.displayBadge({
bundle:"com.example.actsanslocalcandisplaytest"
},true).then(async(err) => {
var promise = await notify.isBadgeDisplayed({
bundle:"com.example.actsanslocalcandisplaytest",
})
console.log("===>ActsSetDisplay_test_0900 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
})
})
}) })
...@@ -18,41 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' ...@@ -18,41 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
var time = 1000 var time = 1000
describe('ActsAnsEnableNotificationTest', function () { describe('ActsAnsEnableNotificationTest', function () {
console.info("===========ActsAnsEnableNotificationTest start====================>"); console.info("===========ActsAnsEnableNotificationTest start====================>");
/*
* @tc.number: ActsGetEnable_test_0100
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_0100', 0, async function (done) {
await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
},(err,data) => {
console.log("===>ActsGetEnable_test_0100 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0100====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0200
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_0200', 0, async function (done) {
var promise = await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
})
console.log("===>ActsGetEnable_test_0200 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0200====>");
}, time);
})
/* /*
* @tc.number: ActsGetEnable_test_0300 * @tc.number: ActsGetEnable_test_0300
* @tc.name: isNotificationEnabled() * @tc.name: isNotificationEnabled()
...@@ -129,45 +95,7 @@ describe('ActsAnsEnableNotificationTest', function () { ...@@ -129,45 +95,7 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(promise).assertEqual(undefined) expect(promise).assertEqual(undefined)
done(); done();
}) })
/*
* @tc.number: ActsGetEnable_test_0900
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_0900', 0, async function (done) {
await notify.enableNotification({
bundle:"com.example.actsanslocalnotificationtest"
},true,async(err) => {
console.log("===>ActsGetEnable_test_0900 success===>"+err)
await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
},(err,data) => {
console.log("===>ActsGetEnable_test_0900 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(true)
done();
})
})
})
/*
* @tc.number: ActsGetEnable_test_1000
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_1000', 0, async function (done) {
await notify.enableNotification({
bundle:"com.example.actsanslocalnotificationtest"
},true,async(err) => {
console.log("===>ActsGetEnable_test_1000 success===>"+err)
var promise = await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
})
console.log("===>ActsGetEnable_test_1000 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
})
})
/* /*
* @tc.number: ActsGetEnable_test_1100 * @tc.number: ActsGetEnable_test_1100
* @tc.name: isNotificationEnabled() * @tc.name: isNotificationEnabled()
...@@ -180,17 +108,7 @@ describe('ActsAnsEnableNotificationTest', function () { ...@@ -180,17 +108,7 @@ describe('ActsAnsEnableNotificationTest', function () {
}) })
done(); done();
}) })
/*
* @tc.number: ActsGetEnable_test_1200
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_1200', 0, async function (done) {
var promise = await notify.isNotificationEnabled()
console.log("==========================>ActsGetEnable_test_1200 success=======================>"+promise)
expect(typeof(promise)).assertEqual('boolean')
done();
})
/* /*
* @tc.number: ActsSetEnable_test_0100 * @tc.number: ActsSetEnable_test_0100
* @tc.name: enableNotification() * @tc.name: enableNotification()
...@@ -244,49 +162,7 @@ describe('ActsAnsEnableNotificationTest', function () { ...@@ -244,49 +162,7 @@ describe('ActsAnsEnableNotificationTest', function () {
done(); done();
}) })
}) })
/*
* @tc.number: ActsSetEnable_test_0500
* @tc.name: enableNotification()
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetEnable_test_0500', 0, async function (done) {
await notify.enableNotification({
bundle:"com.example.actsanslocalnotificationtest"
},true,async(err) => {
await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
},(err,data) => {
console.log("===>ActsSetEnable_test_0500 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(true)
done();
})
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0900====>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0600
* @tc.name: enableNotification()
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetEnable_test_0600', 0, async function (done) {
await notify.enableNotification({
bundle:"com.example.actsanslocalnotificationtest"
},true).then(async(err) => {
var promise = await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
})
console.log("===>ActsSetEnable_test_0600 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0600===>");
}, time);
})
/* /*
* @tc.number: ActsSetEnable_test_0700 * @tc.number: ActsSetEnable_test_0700
* @tc.name: enableNotification() * @tc.name: enableNotification()
...@@ -309,54 +185,5 @@ describe('ActsAnsEnableNotificationTest', function () { ...@@ -309,54 +185,5 @@ describe('ActsAnsEnableNotificationTest', function () {
console.debug("====>time out ActsSetEnable_test_0700====>"); console.debug("====>time out ActsSetEnable_test_0700====>");
}, time); }, time);
}) })
/*
* @tc.number: ActsSetEnable_test_0800
* @tc.name: enableNotification()
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetEnable_test_0800', 0, async function (done) {
await notify.enableNotification({
bundle:"com.example.actsanslocalnotificationtest"
},false).then(async(err) => {
var promise = await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
})
console.log("===>ActsSetEnable_test_0800 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(false)
done();
})
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0800===>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0900
* @tc.name: enableNotification()
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetEnable_test_0900', 0, async function (done) {
await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
},(err,data) => {
console.log("===>ActsSetEnable_test_0900 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(false)
})
await notify.enableNotification({
bundle:"com.example.actsanslocalnotificationtest"
},true).then(async(err) => {
var promise = await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
})
console.log("===>ActsSetEnable_test_0900 success===>"+promise)
expect(typeof(promise)).assertEqual('boolean')
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0900===>");
}, time);
})
}) })
...@@ -217,177 +217,6 @@ describe('ActsAnsSubTestXts', function () { ...@@ -217,177 +217,6 @@ describe('ActsAnsSubTestXts', function () {
console.debug("==>disconnectCallbacko code==>"); console.debug("==>disconnectCallbacko code==>");
} }
/*
* @tc.number: ActsSubscriber_test_xts_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0100', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0100==begin==>");
await notify.subscribe(subInfoa, subscribeCallbacka);
setTimeout((async function(){
await notify.unsubscribe(subInfoa, unSubscribeCallbacka);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0100==end==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0200', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0200==begin==>");
var subInfo ={
onConnect:connectCallbackb,
onDisconnect:disconnectCallbackb,
}
await notify.subscribe(subInfo,subscribeCallbackb);
await notify.subscribe(subInfo,subscribeCallbackc);
setTimeout((async function(){
await notify.unsubscribe(subInfo, unSubscribeCallbackb);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0200==end==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0300', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0300==begin==>");
var subInfo ={
onConnect:connectCallbackc,
onDisconnect:disconnectCallbackc,
}
var subInfo2 ={
onConnect:connectCallbackd,
onDisconnect:disconnectCallbackd,
}
await notify.subscribe(subInfo,subscribeCallbackd);
await notify.subscribe(subInfo2,subscribeCallbacke);
setTimeout((async function(){
await notify.unsubscribe(subInfo, unSubscribeCallbackc);
await notify.unsubscribe(subInfo2, unSubscribeCallbackd);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0300==end==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0400', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0400==begin==>");
var subInfo ={
onConnect:connectCallbackf,
onDisconnect:disconnectCallbackf,
}
var subInfo2 ={
onConnect:connectCallbackg,
onDisconnect:disconnectCallbackg,
}
await notify.subscribe(subInfo,subscribeCallbackg);
await notify.subscribe(subInfo,subscribeCallbackh);
await notify.subscribe(subInfo2,subscribeCallbacki);
setTimeout((async function(){
await notify.unsubscribe(subInfo, unSubscribeCallbackf);
await notify.unsubscribe(subInfo2, unSubscribeCallbackg);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0400==end==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0500', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0500==begin==>");
await notify.subscribe(subInfob, {bundleNames:["com.example.actsanspublishtest"]},subscribeCallbackl);
setTimeout((async function(){
await notify.unsubscribe(subInfob, unSubscribeCallbacki);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0500==end3==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0600
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0600', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0600==begin==>");
await notify.subscribe(subInfoc, {bundleNames:["com.example.actsanspublishtest"]}).then(async()=> {
console.log("ActsSubscriber_test_xts_0600=======promise")
setTimeout((async function(){
await notify.unsubscribe(subInfoc, unSubscribeCallbackj)
}),1000);
});
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0600==end==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0700
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0700', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0700==begin==>");
await notify.subscribe(subInfod,
{bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]},subscribeCallbackn);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0700==end==>");
await notify.unsubscribe(subInfod, unSubscribeCallbackl);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0700==end==>");
done();
}),timeout);
})
/*
* @tc.number: ActsSubscriber_test_xts_0800
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0800', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_0800==begin==>");
await notify.subscribe(subInfoe,
{bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]}).then(async()=> {
console.log("ActsSubscriber_test_xts_0800=======promise")
setTimeout((async function(){
await notify.unsubscribe(subInfoe, unSubscribeCallbackm)
}),1000);
});
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_0800==end==>");
done();
}),timeout);
})
/* /*
* @tc.number: ActsSubscriber_test_xts_0900 * @tc.number: ActsSubscriber_test_xts_0900
* @tc.name: subscribe() * @tc.name: subscribe()
...@@ -451,27 +280,6 @@ describe('ActsAnsSubTestXts', function () { ...@@ -451,27 +280,6 @@ describe('ActsAnsSubTestXts', function () {
}),timeout); }),timeout);
}) })
/*
* @tc.number: ActsSubscriber_test_xts_1300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_1300', 0, async function (done) {
console.debug("==ActsSubscriber_test_xts_1300==begin==>");
var subInfo ={
onConnect:connectCallbackl,
onDisconnect:disconnectCallbackn,
}
await notify.subscribe(subInfo,{bundleNames:["wrongBudleName"]},subscribeCallbacko);
setTimeout((async function(){
await notify.unsubscribe(subInfo, unSubscribeCallbackn);
}),1000);
setTimeout((async function(){
console.debug("==ActsSubscriber_test_xts_1300==end==>");
done();
}),timeout);
})
/* /*
* @tc.number: ActsSubscriber_test_xts_1400 * @tc.number: ActsSubscriber_test_xts_1400
* @tc.name: subscribe() * @tc.name: subscribe()
......
...@@ -24,300 +24,6 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -24,300 +24,6 @@ describe('ActsAnsUnSubscriberTest', function () {
console.debug("===============Ans_UnSubscriber_0100 onDisconnect=================>"); console.debug("===============Ans_UnSubscriber_0100 onDisconnect=================>");
} }
/*
* @tc.number: Ans_UnSubscriber_0100
* @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the subscription can be successfully unsubscribed(callback)
*/
it('Ans_UnSubscriber_0100', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0100 start=============>");
var subscriber ={
onConnect:onConnecteOne,
onDisconnect:onDisconnectOne
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0100 subscribe=============>");
notify.unsubscribe(subscriber, (err)=>{
console.debug("===========Ans_UnSubscriber_0100 unsubscribe err.code=================>"+err.code);
expect(err.code).assertEqual(0);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0100 setTimeout=============>");
done();
}, time);
})
function onConnecteTwo() {
console.debug("============Ans_UnSubscriber_0200 onConnecteTwo=================>");
}
function onDisconnectTwo() {
console.debug("============Ans_UnSubscriber_0200 onDisconnectTwo=================>");
}
/*
* @tc.number: Ans_UnSubscriber_0200
* @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
* @tc.desc: Verify that the subscription can be successfully unsubscribed(promise)
*/
it('Ans_UnSubscriber_0200', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0200 start=============>");
var subscriber ={
onConnect:onConnecteTwo,
onDisconnect:onDisconnectTwo
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0200 subscribe=============>");
notify.unsubscribe(subscriber).then(()=>{
console.debug("=======Ans_UnSubscriber_0200 subscribe then==========>");
}).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0200 subscribe catch err==========>"+err.code);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0200 setTimeout=============>");
done();
}, time);
})
function onConnecteThree() {
console.debug("=======Ans_UnSubscriber_0300 onConnecteThree=================>");
}
function onDisconnectThree() {
console.debug("=======Ans_UnSubscriber_0300 onDisconnectThree=================>");
expect().assertFail();
}
/*
* @tc.number: Ans_UnSubscriber_0300
* @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
* @tc.desc: Verify the use of the wrong subscriber to unsubscribe(callback)
*/
it('Ans_UnSubscriber_0300', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0300 start=============>");
var subscriber ={
onConnect:onConnecteThree,
onDisconnect:onDisconnectThree
}
var subscriberErr ={
onConnect:"",
onDisconnect:""
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0300 subscribe=============>");
notify.unsubscribe(subscriberErr,(err)=>{
console.debug("Ans_UnSubscriber_0300 unsubscribe callback err=========>"+err.code);
expect(err.code != 0).assertEqual(true);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0300 setTimeout=============>");
done();
}, time);
})
function onConnecteFour() {
console.debug("=======Ans_UnSubscriber_0400 onConnecteFour=================>");
}
function onDisconnectFour() {
console.debug("=======Ans_UnSubscriber_0400 onDisconnectFour=================>");
expect().assertFail();
}
/*
* @tc.number: Ans_UnSubscriber_0400
* @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
* @tc.desc: Verify the use of the wrong subscriber to unsubscribe(promise)
*/
it('Ans_UnSubscriber_0400', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0400 start=============>");
var subscriber ={
onConnect:onConnecteFour,
onDisconnect:onDisconnectFour
}
var subscriberErr ={
onConnect:"",
onDisconnect:""
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0400 subscribe=============>");
notify.unsubscribe(subscriberErr).then().catch((err)=>{
console.debug("=======Ans_UnSubscriber_0400 subscribe catch err==========>"+err.code);
expect(err.code != 0).assertEqual(true);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0400 setTimeout=============>");
done();
}, time);
})
function onConnecteFive() {
console.debug("=======Ans_UnSubscriber_0500 onConnecteFive=================>");
}
function onDisconnectFive() {
console.debug("=======Ans_UnSubscriber_0500 onDisconnectFive=================>");
expect().assertFail();
}
function onConnecteTest() {
console.debug("=======Ans_UnSubscriber_0500 onConnecteTest=================>");
expect().assertFail();
}
function onDisconnectTest() {
console.debug("=======Ans_UnSubscriber_0500 onDisconnectTest=================>");
expect().assertFail();
}
/*
* @tc.number: Ans_UnSubscriber_0500
* @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that inconsistent subscriber is used to unsubscribe(callback)
*/
it('Ans_UnSubscriber_0500', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0500 start=============>");
var subscriber ={
onConnect:onConnecteFive,
onDisconnect:onDisconnectFive
}
var subscriberTest ={
onConnect:onConnecteTest,
onDisconnect:onDisconnectTest
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0500 subscribe=============>");
notify.unsubscribe(subscriberTest,(err)=>{
console.debug("Ans_UnSubscriber_0500 unsubscribe err.code=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
console.info("===========Ans_UnSubscriber_0500 unsubscribe=============>");
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0500 setTimeout=============>");
done();
}, time);
})
function onConnecteSix() {
console.debug("=======Ans_UnSubscriber_0600 onConnecteSix =================>");
}
function onDisconnectSix() {
console.debug("=======Ans_UnSubscriber_0600 onDisconnectSix=================>");
expect().assertFail();
}
function onConnecteTestTwo() {
console.debug("=======Ans_UnSubscriber_0600 onConnecteTestTwo=================>");
expect().assertFail();
}
function onDisconnectTestTwo() {
console.debug("=======Ans_UnSubscriber_0600 onDisconnectTestTwo=================>");
expect().assertFail();
}
/*
* @tc.number: Ans_UnSubscriber_0600
* @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
* @tc.desc: Verify that inconsistent subscriber is used to unsubscribe(promise)
*/
it('Ans_UnSubscriber_0600', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0600 start=============>");
var subscriber ={
onConnect:onConnecteSix,
onDisconnect:onDisconnectSix
}
var subscriberTest ={
onConnect:onConnecteTestTwo,
onDisconnect:onDisconnectTestTwo
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0600 subscribe=============>");
notify.unsubscribe(subscriberTest).then().catch((err)=>{
console.debug("=======Ans_UnSubscriber_0600 unsubscribe catch err=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0600 setTimeout=============>");
done();
}, time);
})
function onConnecteSeven() {
console.debug("=======Ans_UnSubscriber_0700 onConnecteSeven=================>");
}
var timesOfOnDis
function onDisconnectSeven() {
console.debug("=======Ans_UnSubscriber_0700 onDisconnectSeven=================>");
timesOfOnDis ++;
if(timesOfOnDis == 2){
expect().assertFail();
}
}
/*
* @tc.number: Ans_UnSubscriber_0700
* @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
* @tc.desc:Verification: After the subscription is successful, unsubscribe twice in a row.(callback)
*/
it('Ans_UnSubscriber_0700', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0700 start=============>");
timesOfOnDis = 0
var subscriber ={
onConnect:onConnecteSeven,
onDisconnect:onDisconnectSeven
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0700 subscribe=============>");
notify.unsubscribe(subscriber, (err)=>{
console.debug("Ans_UnSubscriber_0700 unsubscribe first err.code=================>"+err.code);
expect(err.code).assertEqual(0);
notify.unsubscribe(subscriber, (err)=>{
console.debug("Ans_UnSubscriber_0700 unsubscribe Second err.code=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0700 setTimeout=============>");
done();
}, time);
})
function onConnecteEight() {
console.debug("=======Ans_UnSubscriber_0800 onConnecteEight=================>");
}
var timesOfOnDisTwo
function onDisconnectEight() {
console.debug("=======Ans_UnSubscriber_0800 onDisconnectEight err.code=================>");
timesOfOnDisTwo ++;
if(timesOfOnDisTwo == 2){
expect().assertFail();
}
}
/*
* @tc.number: Ans_UnSubscriber_0800
* @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
* @tc.desc: Verification: After the subscription is successful, unsubscribe twice in a row.(promise)
*/
it('Ans_UnSubscriber_0800', 0, async function (done) {
console.info("===========Ans_UnSubscriber_0800 start=============>");
timesOfOnDisTwo = 0
var subscriber ={
onConnect:onConnecteEight,
onDisconnect:onDisconnectEight
}
await notify.subscribe(subscriber);
console.info("===========Ans_UnSubscriber_0800 subscribe=============>");
notify.unsubscribe(subscriber).then((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe first then err=================>"+err.code);
notify.unsubscribe(subscriber).then((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe second then err=================>"+err.code);
}).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe second catch err=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
}).catch((err)=>{
console.debug("=======Ans_UnSubscriber_0800 subscribe first catch err=================>"+err.code);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_0800 setTimeout=============>");
done();
}, time);
})
function onDisconnectTestNine() { function onDisconnectTestNine() {
console.debug("=======Ans_UnSubscriber_0900 onDisconnectTestNine =================>"); console.debug("=======Ans_UnSubscriber_0900 onDisconnectTestNine =================>");
expect().assertFail(); expect().assertFail();
...@@ -377,76 +83,5 @@ describe('ActsAnsUnSubscriberTest', function () { ...@@ -377,76 +83,5 @@ describe('ActsAnsUnSubscriberTest', function () {
done(); done();
}, time); }, time);
}) })
function onConnecteEleven() {
console.debug("============Ans_UnSubscriber_1100 onConnecteEleven=================>");
}
function onDisconnectEleven() {
console.debug("============Ans_UnSubscriber_1100 onDisconnectEleven=================>");
expect().assertFail();
}
/*
* @tc.number: Ans_UnSubscriber_1100
* @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void;
* @tc.desc: Verify: After the subscription with anonymous Subscribers is successful,
unsubscribing with anonymous subscribers will fail(callback)
*/
it('Ans_UnSubscriber_1100', 0, async function (done) {
console.info("===========Ans_UnSubscriber_1100 start=============>");
await notify.subscribe({
onConnect:onConnecteEleven,
onDisconnect:onDisconnectEleven
});
notify.unsubscribe(
{
onConnect:onConnecteOne,
onDisconnect:onDisconnectOne
},
(err)=>{
console.debug("Ans_UnSubscriber_1100 unSubscribeCallbackEleven err.code=================>"+err.code);
expect(err.code != 0).assertEqual(true);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_1100 setTimeout=============>");
done();
}, time);
})
function onConnecteTwelve() {
console.debug("============Ans_UnSubscriber_1200 onConnecteTwelve=================>");
}
function onDisconnectTwelve() {
console.debug("============Ans_UnSubscriber_1200 onDisconnectTwelve=================>");
expect().assertFail();
}
/*
* @tc.number: Ans_UnSubscriber_1200
* @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise<void>;
* @tc.desc: Verify: After the subscription with anonymous Subscribers is successful,
unsubscribing with anonymous subscribers will fail(promise)
*/
it('Ans_UnSubscriber_1200', 0, async function (done) {
console.info("===========Ans_UnSubscriber_1200 start=============>");
await notify.subscribe({
onConnect:onConnecteTwelve,
onDisconnect:onConnecteTwelve
});
notify.unsubscribe({
onConnect:onConnecteTwelve,
onDisconnect:onDisconnectTwelve
}).then((err)=>{
console.info("===========Ans_UnSubscriber_1200 unsubscribe then err=============>"+err.code);
}).catch((err)=>{
console.info("===========Ans_UnSubscriber_1200 unsubscribe catch err=============>"+err.code);
expect(err.code != 0).assertEqual(true);
});
setTimeout(function(){
console.debug("===========Ans_UnSubscriber_1200 setTimeout=============>");
done();
}, time);
});
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册