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 66b23c22330cb8e98b96f1612fffd9c9b10d685d..b0f8d3899361caa5d980775bdbe3b6136f6a032f 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