From d061350f077e0d8322b9004755e39c2bf9fd24c4 Mon Sep 17 00:00:00 2001 From: zhijianwen Date: Thu, 7 Jul 2022 11:00:23 +0800 Subject: [PATCH] cancel Signed-off-by: zhijianwen --- .../js/test/ActsAnsNotificationCancel.test.js | 122 ++++++++++++------ 1 file changed, 83 insertions(+), 39 deletions(-) diff --git a/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js b/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js index 66b23c223..b0f8d3899 100644 --- a/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js +++ b/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js @@ -2022,44 +2022,88 @@ describe('ActsAnsNotificationCancel', function () { }),timeout); }) + /* + * @tc.number: ANS_Cancel_2700 + * @tc.name: cancel(id: number, label?: string): Promise + * @tc.desc: add NotificationTemplate extraInfo template badgeNumber + */ + it('ANS_Cancel_2700', 0, async function (done) { + console.info('===============ANS_Cancel_2700 start==========================>'); + let subscriber ={ + onConsume:onConsumeCancelWrongLabelWrongIdPromise, + onCancel:onCancelCancelWrongLabelWrongIdPromise, + } + await notify.subscribe(subscriber); + console.info('===============ANS_Cancel_2700 subscribe promise==================>'); + let NotificationTemplate = { + name:'/system/etc/notification_template/assets/js/downloadTemplate.js', + data:{key3:"789",key4:"111"} + } + let notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: 'test_title', + text: 'test_text', + additionalText: 'test_additionalText' + }, + }, + extraInfo:{ + key1: "1231", + key2:"456" + }, + template:NotificationTemplate, + badgeNumber:1, + } + await notify.publish(notificationRequest); + console.info('===============ANS_Cancel_2700 publish promise==================>'); + setTimeout((async function(){ + await notify.unsubscribe(subscriber); + console.info('======ANS_Cancel_2700 setTimeout unsubscribe end==================>'); + done(); + }),timeout); + }) + /* - * @tc.number: ANS_Cancel_2700 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: add - */ - it('ANS_Cancel_2700', 0, async function (done) { - console.info('===============ANS_Cancel_2700 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabelWrongIdPromise, - onCancel:onCancelCancelWrongLabelWrongIdPromise, - } - await notify.subscribe(subscriber); - console.info('===============ANS_Cancel_2700 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - extraInfo:{ - key1: "1231", - key2:"456" - }, - template:{ - name:'/system/etc/notification_template/assets/js/downloadTemplate.js', - data:{key3:"789",key4:"111"} - }, - badgeNumber:1, - } - await notify.publish(notificationRequest); - console.info('===============ANS_Cancel_2700 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2700 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) + * @tc.number: ANS_Cancel_2800 + * @tc.name: cancel(id: number, label?: string): Promise + * @tc.desc: add creatorPid + */ + it('ANS_Cancel_2800', 0, async function (done) { + console.info('===============ANS_Cancel_2800 start==========================>'); + let subscriber ={ + onConsume:onConsumeCancelWrongLabelWrongIdPromise, + onCancel:onCancelCancelWrongLabelWrongIdPromise, + } + await notify.subscribe(subscriber); + console.info('===============ANS_Cancel_2800 subscribe promise==================>'); + + let NotificationTemplate = { + name:'/system/etc/notification_template/assets/js/downloadTemplate.js', + data:{key3:"789",key4:"111"} + } + let notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: 'test_title', + text: 'test_text', + additionalText: 'test_additionalText' + }, + }, + extraInfo:{ + key1: "1231", + key2:"456" + }, + template:NotificationTemplate, + creatorPid:1, + } + await notify.publish(notificationRequest); + console.info('===============ANS_Cancel_2800 publish promise==================>'); + setTimeout((async function(){ + await notify.unsubscribe(subscriber); + console.info('======ANS_Cancel_2800 setTimeout unsubscribe end==================>'); + done(); + }),timeout); + }) }) \ No newline at end of file -- GitLab