Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
db47076f
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
db47076f
编写于
4月 25, 2022
作者:
F
fjr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
XTS整改
Signed-off-by:
N
fjr
<
fujiarui6@huawei.com
>
上级
f316b279
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
14 addition
and
3088 deletion
+14
-3088
notification/ans_standard/BUILD.gn
notification/ans_standard/BUILD.gn
+1
-1
notification/ans_standard/publish_test/BUILD.gn
notification/ans_standard/publish_test/BUILD.gn
+4
-2
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActiveButton.js
...vebtn/activebutton/entry/src/main/js/test/ActiveButton.js
+2
-739
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js
...ctsansgetallactive/entry/src/main/js/test/getAllActive.js
+0
-337
notification/ans_standard/publish_test/badgedisplayed/badgedisplay/entry/src/main/js/test/BadgeDisplay.js
...layed/badgedisplay/entry/src/main/js/test/BadgeDisplay.js
+3
-135
notification/ans_standard/publish_test/donotdisturbmode/entry/src/main/js/test/doNotDisturbTest.js
...notdisturbmode/entry/src/main/js/test/doNotDisturbTest.js
+0
-1140
notification/ans_standard/publish_test/enablenotification/enablenotification/entry/src/main/js/test/EnableNotification.js
...notification/entry/src/main/js/test/EnableNotification.js
+4
-177
notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js
...ard/publish_test/sub/entry/src/main/js/test/Subscriber.js
+0
-192
notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/UnSubscriber.js
...h_test/unsubscribe/entry/src/main/js/test/UnSubscriber.js
+0
-365
未找到文件。
notification/ans_standard/BUILD.gn
浏览文件 @
db47076f
...
...
@@ -16,7 +16,7 @@ group("ans_standard") {
testonly = true
if (is_standard_system) {
deps = [
"actsansnotificationcancel:ActsAnsNotificationCancelTest",
#
"actsansnotificationcancel:ActsAnsNotificationCancelTest",
"actsansnotificationremove:ActsAnsNotificationRemoveTest",
"actsansslottest:ActsAnsSlotTest",
"publish_test:publish_test",
...
...
notification/ans_standard/publish_test/BUILD.gn
浏览文件 @
db47076f
...
...
@@ -26,14 +26,16 @@ group("publish_test") {
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
"activebtn:activebtn",
"actsansdistributedtest:ActsAnsDistributeTest",
#"actsansdistributedtest:ActsAnsDistributeTest",
"actsansgetallactive:ActsAnsGetAllActiveTestXts",
"ansactscancelgroup:ActsAnsCancelGroupTest",
"ansactsremovegroup:ActsAnsRemoveGroupTest",
"donotdisturbmode:ActsAnsDoNotDisturbTest",
"publish:ActsAnsNotificationPublishXts",
"publishsound:ActsAnsPublishSoundTest",
"publishvibra:ActsAnsPublishVibraTest",
#"publishvibra:ActsAnsPublishVibraTest",
"sub:ActsAnsSubTestXts",
"unsubscribe:ActsAnsUnSubscriberTest",
"wantagent:wantagent",
...
...
notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActiveButton.js
浏览文件 @
db47076f
此差异已折叠。
点击以展开。
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js
浏览文件 @
db47076f
...
...
@@ -95,342 +95,5 @@ describe('ActsAnsGetAllActiveTestXts', function () {
done
();
},
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
);
})
})
notification/ans_standard/publish_test/badgedisplayed/badgedisplay/entry/src/main/js/test/BadgeDisplay.js
浏览文件 @
db47076f
...
...
@@ -32,22 +32,7 @@ describe('ActsAnsBadgeDisplayTest', function () {
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.name: isBadgeDisplayed()
...
...
@@ -122,45 +107,7 @@ describe('ActsAnsBadgeDisplayTest', function () {
expect
(
promise
).
assertEqual
(
undefined
)
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.name: displayBadge()
...
...
@@ -214,43 +161,7 @@ describe('ActsAnsBadgeDisplayTest', function () {
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.name: displayBadge()
...
...
@@ -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
();
})
})
})
notification/ans_standard/publish_test/donotdisturbmode/entry/src/main/js/test/doNotDisturbTest.js
浏览文件 @
db47076f
此差异已折叠。
点击以展开。
notification/ans_standard/publish_test/enablenotification/enablenotification/entry/src/main/js/test/EnableNotification.js
浏览文件 @
db47076f
...
...
@@ -18,41 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
var
time
=
1000
describe
(
'
ActsAnsEnableNotificationTest
'
,
function
()
{
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.name: isNotificationEnabled()
...
...
@@ -129,45 +95,7 @@ describe('ActsAnsEnableNotificationTest', function () {
expect
(
promise
).
assertEqual
(
undefined
)
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.name: isNotificationEnabled()
...
...
@@ -180,17 +108,7 @@ describe('ActsAnsEnableNotificationTest', function () {
})
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.name: enableNotification()
...
...
@@ -244,49 +162,7 @@ describe('ActsAnsEnableNotificationTest', function () {
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.name: enableNotification()
...
...
@@ -309,54 +185,5 @@ describe('ActsAnsEnableNotificationTest', function () {
console
.
debug
(
"
====>time out ActsSetEnable_test_0700====>
"
);
},
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
);
})
})
notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js
浏览文件 @
db47076f
...
...
@@ -217,177 +217,6 @@ describe('ActsAnsSubTestXts', function () {
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.name: subscribe()
...
...
@@ -451,27 +280,6 @@ describe('ActsAnsSubTestXts', function () {
}),
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.name: subscribe()
...
...
notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/UnSubscriber.js
浏览文件 @
db47076f
...
...
@@ -24,300 +24,6 @@ describe('ActsAnsUnSubscriberTest', function () {
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
()
{
console
.
debug
(
"
=======Ans_UnSubscriber_0900 onDisconnectTestNine =================>
"
);
expect
().
assertFail
();
...
...
@@ -377,76 +83,5 @@ describe('ActsAnsUnSubscriberTest', function () {
done
();
},
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录