Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4fa848fb
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看板
提交
4fa848fb
编写于
5月 21, 2022
作者:
W
wangcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增dataAbilityHelper.call测试用例
Signed-off-by:
N
wangcheng
<
wangcheng@kaihongdigi.com
>
上级
39074cd3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
150 addition
and
23 deletion
+150
-23
aafwk/aafwk_standard/actsdataabilityjs/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
...tyjs/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
+150
-23
未找到文件。
aafwk/aafwk_standard/actsdataabilityjs/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
浏览文件 @
4fa848fb
...
@@ -62,7 +62,7 @@ afterAll((done) => {
...
@@ -62,7 +62,7 @@ afterAll((done) => {
done
();
done
();
},
gSetTimeout
);
},
gSetTimeout
);
})
})
/*
/*
* @tc.number: ACTS_AfeatureAbilityEnum_0100
* @tc.number: ACTS_AfeatureAbilityEnum_0100
* @tc.name: Enum the client resource of the Data ability.
* @tc.name: Enum the client resource of the Data ability.
...
@@ -74,7 +74,7 @@ it('ACTS_AfeatureAbilityEnum_0100', 0, async function (done) {
...
@@ -74,7 +74,7 @@ it('ACTS_AfeatureAbilityEnum_0100', 0, async function (done) {
expect
(
featureAbility
.
ContinuationState
.
LOCAL_RUNNING
).
assertEqual
(
0
);
expect
(
featureAbility
.
ContinuationState
.
LOCAL_RUNNING
).
assertEqual
(
0
);
expect
(
featureAbility
.
ContinuationState
.
REMOTE_RUNNING
).
assertEqual
(
1
);
expect
(
featureAbility
.
ContinuationState
.
REMOTE_RUNNING
).
assertEqual
(
1
);
expect
(
featureAbility
.
ContinuationState
.
REPLICA_RUNNING
).
assertEqual
(
2
);
expect
(
featureAbility
.
ContinuationState
.
REPLICA_RUNNING
).
assertEqual
(
2
);
expect
(
abilityManager
.
ProcessErrCode
.
NO_ERROR
).
assertEqual
(
0
);
expect
(
abilityManager
.
ProcessErrCode
.
NO_ERROR
).
assertEqual
(
0
);
expect
(
abilityManager
.
ProcessErrCode
.
CRASHED
).
assertEqual
(
1
);
expect
(
abilityManager
.
ProcessErrCode
.
CRASHED
).
assertEqual
(
1
);
expect
(
abilityManager
.
ProcessErrCode
.
NO_RESPONSE
).
assertEqual
(
2
);
expect
(
abilityManager
.
ProcessErrCode
.
NO_RESPONSE
).
assertEqual
(
2
);
...
@@ -750,11 +750,10 @@ it("ACTS_Call_0100", 0, async function (done) {
...
@@ -750,11 +750,10 @@ it("ACTS_Call_0100", 0, async function (done) {
console
.
log
(
'
ACTS_Call_0100 end......
'
);
console
.
log
(
'
ACTS_Call_0100 end......
'
);
})
})
/*
/*
* @tc.number: ACTS_Call_0200
* @tc.number: ACTS_Call_0200
* @tc.name: call : Queries data in the database.
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.desc: Check the return value of the interface
(by promise)
* @tc.level 0
* @tc.level 0
*/
*/
it
(
"
ACTS_Call_0200
"
,
0
,
async
function
(
done
)
{
it
(
"
ACTS_Call_0200
"
,
0
,
async
function
(
done
)
{
...
@@ -768,13 +767,12 @@ it("ACTS_Call_0200", 0, async function (done) {
...
@@ -768,13 +767,12 @@ it("ACTS_Call_0200", 0, async function (done) {
try
{
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
query
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
rDAHelper
.
call
(
dataAbilityUri
,
'
query
'
,
arg
,
pacMap
).
then
((
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
ACTS_Call_0200 succeeded data:
'
+
JSON
.
stringify
(
data
));
console
.
error
(
'
ACTS_Call_0200 error:
'
+
JSON
.
stringify
(
err
));
}).
catch
((
error
)
=>
{
}
else
{
console
.
error
(
'
ACTS_Call_0200 error:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
ACTS_Call_0200 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
});
done
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0200 catch(err)====>:
'
+
err
);
console
.
error
(
'
ACTS_Call_0200 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0200====<end catch(err)
'
);
console
.
log
(
'
ACTS_Call_0200====<end catch(err)
'
);
...
@@ -786,7 +784,7 @@ it("ACTS_Call_0200", 0, async function (done) {
...
@@ -786,7 +784,7 @@ it("ACTS_Call_0200", 0, async function (done) {
/*
/*
* @tc.number: ACTS_Call_0300
* @tc.number: ACTS_Call_0300
* @tc.name: call : Updates data records in the database.
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.desc: Check the return value of the interface
(by promise)
* @tc.level 0
* @tc.level 0
*/
*/
it
(
"
ACTS_Call_0300
"
,
0
,
async
function
(
done
)
{
it
(
"
ACTS_Call_0300
"
,
0
,
async
function
(
done
)
{
...
@@ -800,13 +798,12 @@ it("ACTS_Call_0300", 0, async function (done) {
...
@@ -800,13 +798,12 @@ it("ACTS_Call_0300", 0, async function (done) {
try
{
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
update
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
rDAHelper
.
call
(
dataAbilityUri
,
'
update
'
,
arg
,
pacMap
).
then
((
data
)
=>
{
if
(
err
)
{
console
.
info
(
'
ACTS_Call_0300 succeeded data:
'
+
JSON
.
stringify
(
data
));
console
.
error
(
'
ACTS_Call_0300 error:
'
+
JSON
.
stringify
(
err
));
}).
catch
((
error
)
=>
{
}
else
{
console
.
error
(
'
ACTS_Call_0300 error:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
ACTS_Call_0300 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
});
done
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0300 catch(err)====>:
'
+
err
);
console
.
error
(
'
ACTS_Call_0300 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0300====<end catch(err)
'
);
console
.
log
(
'
ACTS_Call_0300====<end catch(err)
'
);
...
@@ -818,7 +815,7 @@ it("ACTS_Call_0300", 0, async function (done) {
...
@@ -818,7 +815,7 @@ it("ACTS_Call_0300", 0, async function (done) {
/*
/*
* @tc.number: ACTS_Call_0400
* @tc.number: ACTS_Call_0400
* @tc.name: call : Deletes one or more data records from the database.
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.desc: Check the return value of the interface
(by promise)
* @tc.level 0
* @tc.level 0
*/
*/
it
(
"
ACTS_Call_0400
"
,
0
,
async
function
(
done
)
{
it
(
"
ACTS_Call_0400
"
,
0
,
async
function
(
done
)
{
...
@@ -828,23 +825,153 @@ it("ACTS_Call_0400", 0, async function (done) {
...
@@ -828,23 +825,153 @@ it("ACTS_Call_0400", 0, async function (done) {
'
ringtone_modify_time
'
:
32
,
'
ringtone_modify_time
'
:
32
,
};
};
var
rDAHelper
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
delete
'
,
arg
,
pacMap
).
then
((
data
)
=>
{
console
.
info
(
'
ACTS_Call_0400 succeeded data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
ACTS_Call_0400 error:
'
+
JSON
.
stringify
(
error
));
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0400 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0400====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0400 end......
'
);
})
/*
* @tc.number: ACTS_Call_0500
* @tc.name: call : Inserts a single data record into the database.
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it
(
"
ACTS_Call_0500
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0500 start......
'
);
var
pacMap
=
{
'
groupName
'
:
'
test1
'
,
'
ringtone_modify_time
'
:
28
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
expect
(
typeof
(
rDAHelper
)).
assertEqual
(
"
object
"
);
pacMap
.
groupName
=
'
test2
'
;
rDAHelper
.
call
(
dataAbilityUri
,
'
insert
'
,
''
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0500 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0500 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0500 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0500====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0500 end......
'
);
})
/*
* @tc.number: ACTS_Call_0600
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it
(
"
ACTS_Call_0600
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0600 start......
'
);
var
arg
=
"
{
\"
equalTo
\"
:
\"
groupName
\"
}
"
;
var
pacMap
=
{
"
groupName
"
:
"
test1
"
,
"
columns
"
:
"
groupName,ringtone_modify_time
"
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
query
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0600 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0600 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0600 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0600====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0600 end......
'
);
})
/*
* @tc.number: ACTS_Call_0700
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it
(
"
ACTS_Call_0700
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0700 start......
'
);
var
arg
=
"
{
\"
equalTo
\"
:
\"
ringtone_modify_time
\"
}
"
;
var
pacMap
=
{
'
ringtone_modify_time
'
:
28
,
'
groupName
'
:
'
testupdata1
'
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
update
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0700 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0700 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0700 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0700====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0700 end......
'
);
})
/*
* @tc.number: ACTS_Call_0800
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it
(
"
ACTS_Call_0800
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0800 start......
'
);
var
arg
=
"
{
\"
lessThan
\"
:
\"
ringtone_modify_time
\"
}
"
;
var
pacMap
=
{
'
ringtone_modify_time
'
:
32
,
};
var
rDAHelper
try
{
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
delete
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
rDAHelper
.
call
(
dataAbilityUri
,
'
delete
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0
4
00 error:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
ACTS_Call_0
8
00 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
'
ACTS_Call_0
4
00 succeeded:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
ACTS_Call_0
8
00 succeeded:
'
+
JSON
.
stringify
(
data
));
}
}
});
});
done
();
done
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0
4
00 catch(err)====>:
'
+
err
);
console
.
error
(
'
ACTS_Call_0
8
00 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0
4
00====<end catch(err)
'
);
console
.
log
(
'
ACTS_Call_0
8
00====<end catch(err)
'
);
done
();
done
();
}
}
console
.
log
(
'
ACTS_Call_0
4
00 end......
'
);
console
.
log
(
'
ACTS_Call_0
8
00 end......
'
);
})
})
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录