Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
282f1e61
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看板
提交
282f1e61
编写于
7月 21, 2022
作者:
H
heyuean
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Signed-off-by: heyuean <heyuean@huawei.com>
上级
62b688ad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
179 addition
and
1 deletion
+179
-1
updater/update_test/src/main/js/default/test/update.test.js
updater/update_test/src/main/js/default/test/update.test.js
+179
-1
未找到文件。
updater/update_test/src/main/js/default/test/update.test.js
浏览文件 @
282f1e61
...
...
@@ -2069,4 +2069,182 @@ describe('updateclient', function() {
console
.
info
(
'
[client.getUpdaterFromOther] success.
'
);
console
.
info
(
'
testGetUpdaterFromOther END
'
);
});
});
/**
* @tc.number SUB_UPDATE_JS_API_0092
* @tc.name testApplyNewVersionCallback
* @tc.desc Test testApplyNewVersionCallback obj.
*/
it
(
'
testApplyNewVersionCallback
'
,
0
,
function
(){
console
.
info
(
'
testApplyNewVersionCallback START
'
);
try
{
if
(
client
===
undefined
){
console
.
error
(
"
client not defined
"
);
return
;
}
if
(
updater
===
undefined
){
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
let
ret
=
updater
.
applyNewVersion
((
err
,
data
)
=>
{
console
.
log
(
"
UPDATE_TEST applyNewVersionCallback success
"
+
data
);
});
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testApplyNewVersionCallback] fail.
'
+
e
);
}
console
.
info
(
'
[updater.applyNewVersion] success.
'
);
console
.
info
(
'
testApplyNewVersionCallback END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0093
* @tc.name testApplyNewVersionPromise
* @tc.desc Test testApplyNewVersionPromise obj.
*/
it
(
'
testApplyNewVersionPromise
'
,
0
,
function
(){
console
.
info
(
'
testApplyNewVersionPromise START
'
);
try
{
if
(
client
===
undefined
){
console
.
error
(
"
client not defined
"
);
return
;
}
if
(
updater
===
undefined
){
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
let
ret
=
updater
.
applyNewVersion
().
then
((
err
,
data
)
=>
{
console
.
log
(
"
UPDATE_TEST applyNewVersionPromise success
"
+
data
);
});
expect
(
ret
).
assertInstanceOf
(
'
Promise
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testApplyNewVersionPromise] fail.
'
+
e
);
}
console
.
info
(
'
[updater.applyNewVersion] success.
'
);
console
.
info
(
'
testApplyNewVersionPromise END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0094
* @tc.name testRebootAndCleanCacheCallback
* @tc.desc Test testRebootAndCleanCacheCallback obj.
*/
it
(
'
testRebootAndCleanCacheCallback
'
,
0
,
function
(){
console
.
info
(
'
testRebootAndCleanCacheCallback START
'
);
try
{
if
(
client
===
undefined
){
console
.
error
(
"
client not defined
"
);
return
;
}
if
(
updater
===
undefined
){
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
let
ret
=
updater
.
rebootAndCleanCache
((
err
,
data
)
=>
{
console
.
log
(
"
UPDATE_TEST testRebootAndCleanCacheCallback success
"
+
data
);
});
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testRebootAndCleanCacheCallback] fail.
'
+
e
);
}
console
.
info
(
'
[updater.rebootAndCleanCache] success.
'
);
console
.
info
(
'
testRebootAndCleanCacheCallback END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0095
* @tc.name testRebootAndCleanCachePromise
* @tc.desc Test testRebootAndCleanCachePromise obj.
*/
it
(
'
testRebootAndCleanCachePromise
'
,
0
,
function
(){
console
.
info
(
'
testRebootAndCleanCachePromise START
'
);
try
{
if
(
client
===
undefined
){
console
.
error
(
"
client not defined
"
);
return
;
}
if
(
updater
===
undefined
){
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
let
ret
=
updater
.
rebootAndCleanCache
().
then
((
err
,
data
)
=>
{
console
.
log
(
"
UPDATE_TEST testRebootAndCleanCachePromise success
"
+
data
);
});
expect
(
ret
).
assertInstanceOf
(
'
Promise
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testRebootAndCleanCachePromise] fail.
'
+
e
);
}
console
.
info
(
'
[updater.rebootAndCleanCache] success.
'
);
console
.
info
(
'
testRebootAndCleanCachePromise END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0096
* @tc.name testRebootAndCleanUserDataCallback
* @tc.desc Test testRebootAndCleanUserDataCallback obj.
*/
it
(
'
testRebootAndCleanUserDataCallback
'
,
0
,
function
(){
console
.
info
(
'
testRebootAndCleanUserDataCallback START
'
);
try
{
if
(
client
===
undefined
){
console
.
error
(
"
client not defined
"
);
return
;
}
if
(
updater
===
undefined
){
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
let
ret
=
updater
.
rebootAndCleanUserData
((
err
,
data
)
=>
{
console
.
log
(
"
UPDATE_TEST testRebootAndCleanUserDataCallback success
"
+
data
);
});
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testRebootAndCleanUserDataCallback] fail.
'
+
e
);
}
console
.
info
(
'
[updater.rebootAndCleanUserData] success.
'
);
console
.
info
(
'
testRebootAndCleanUserDataCallback END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0097
* @tc.name testRebootAndCleanUserDataPromise
* @tc.desc Test testRebootAndCleanUserDataPromise obj.
*/
it
(
'
testRebootAndCleanUserDataPromise
'
,
0
,
function
(){
console
.
info
(
'
testRebootAndCleanUserDataPromise START
'
);
try
{
if
(
client
===
undefined
){
console
.
error
(
"
client not defined
"
);
return
;
}
if
(
updater
===
undefined
){
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
let
ret
=
updater
.
rebootAndCleanUserData
().
then
((
err
,
data
)
=>
{
console
.
log
(
"
UPDATE_TEST testRebootAndCleanUserDataPromise success
"
+
data
);
});
expect
(
ret
).
assertInstanceOf
(
'
Promise
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testRebootAndCleanUserDataPromise] fail.
'
+
e
);
}
console
.
info
(
'
[updater.rebootAndCleanUserData] success.
'
);
console
.
info
(
'
testRebootAndCleanUserDataPromise END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0098
* @tc.name testErrMsg
* @tc.desc check errMsg is defined correct.
*/
it
(
'
testErrMsg
'
,
0
,
function
()
{
console
.
info
(
'
testErrMsg START
'
);
try
{
expect
(
updater
.
NewVersionInfo
.
errMsg
).
assertInstanceOf
(
'
String
'
);
}
catch
(
e
)
{
console
.
error
(
'
[testErrMsg] fail.
'
+
e
);
}
console
.
info
(
'
[ErrMsg] success.
'
);
console
.
info
(
'
testErrMsg END
'
);
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录