Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3859614a
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看板
提交
3859614a
编写于
9月 23, 2021
作者:
T
tuxingsun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add testcase of hiappevent
Signed-off-by:
N
tuxingsun
<
duanhaizhen@huawei.com
>
上级
3203d108
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
79 addition
and
0 deletion
+79
-0
hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/default/test/HiAppEvent.test.js
...ppeventjstest/src/main/js/default/test/HiAppEvent.test.js
+79
-0
未找到文件。
hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/default/test/HiAppEvent.test.js
浏览文件 @
3859614a
...
@@ -494,4 +494,83 @@ describe('HiAppEventApiTest', function () {
...
@@ -494,4 +494,83 @@ describe('HiAppEventApiTest', function () {
});
});
console
.
info
(
'
testHiAppEventApi21 end
'
)
console
.
info
(
'
testHiAppEventApi21 end
'
)
})
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2200
* @tc.name testHiAppEventApi22
* @tc.desc HiAppEvent configure interface with disable option set true.
*/
it
(
'
testHiAppEventApi22
'
,
3
,
function
()
{
console
.
info
(
'
testHiAppEventApi22 start
'
)
let
configret
=
false
;
configret
=
HiAppEvent
.
configure
({
disable
:
true
});
expect
(
configret
==
true
).
assertTrue
();
HiAppEvent
.
configure
({
disable
:
false
});
console
.
info
(
'
testHiAppEventApi22 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2300
* @tc.name testHiAppEventApi23
* @tc.desc HiAppEvent configure interface with disable option set false.
*/
it
(
'
testHiAppEventApi23
'
,
3
,
function
()
{
console
.
info
(
'
testHiAppEventApi23 start
'
)
let
configret
=
false
;
configret
=
HiAppEvent
.
configure
({
disable
:
false
});
expect
(
configret
==
true
).
assertTrue
();
console
.
info
(
'
testHiAppEventApi23 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2400
* @tc.name testHiAppEventApi24
* @tc.desc HiAppEvent configure interface with maxStorage option set 100M.
*/
it
(
'
testHiAppEventApi24
'
,
3
,
function
()
{
console
.
info
(
'
testHiAppEventApi24 start
'
)
let
configret
=
false
;
configret
=
HiAppEvent
.
configure
({
maxStorage
:
'
100M
'
});
console
.
info
(
'
configret = %d
'
,
configret
);
expect
(
configret
==
true
).
assertTrue
();
console
.
info
(
'
testHiAppEventApi24 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2500
* @tc.name testHiAppEventApi25
* @tc.desc HiAppEvent with predefined event and param.
*/
it
(
'
testHiAppEventApi25
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi25 start
'
)
HiAppEvent
.
write
(
HiAppEvent
.
Event
.
USER_LOGIN
,
HiAppEvent
.
EventType
.
BEHAVIOR
,
{[
HiAppEvent
.
Param
.
USER_ID
]:
"
userlogin
"
,
[
HiAppEvent
.
Param
.
DISTRIBUTED_SERVICE_NAME
]:
"
HiAppEvent
"
,
[
HiAppEvent
.
Param
.
DISTRIBUTED_SERVICE_INSTANCE_ID
]:
100
},
(
err
,
value
)
=>
{
console
.
log
(
`HiAppEvent into json-callback`
);
if
(
err
)
{
console
.
error
(
`HiAppEvent json-callback-error code=
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
log
(
`HiAppEvent json-callback-success value=
${
value
}
`
);
expect
(
value
==
0
).
assertTrue
();
done
();
}
});
HiAppEvent
.
write
(
HiAppEvent
.
Event
.
USER_LOGOUT
,
HiAppEvent
.
EventType
.
BEHAVIOR
,
{[
HiAppEvent
.
Param
.
USER_ID
]:
"
userlogout
"
,
[
HiAppEvent
.
Param
.
DISTRIBUTED_SERVICE_NAME
]:
"
HiAppEvent
"
,
[
HiAppEvent
.
Param
.
DISTRIBUTED_SERVICE_INSTANCE_ID
]:
100
},
(
err
,
value
)
=>
{
console
.
log
(
`HiAppEvent into json-callback`
);
if
(
err
)
{
console
.
error
(
`HiAppEvent json-callback-error code=
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
log
(
`HiAppEvent json-callback-success value=
${
value
}
`
);
expect
(
value
==
0
).
assertTrue
();
done
();
}
});
console
.
info
(
'
testHiAppEventApi25 end
'
)
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录