Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
473e6006
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看板
未验证
提交
473e6006
编写于
6月 30, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9164 【Distributeddatamgr】【Master】用例优化;消除用例关联性
Merge pull request !9164 from yanglifeng/master
上级
5a3f1564
155ced5e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
8 deletion
+39
-8
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreDistributedJsunit.test.js
...src/main/js/test/RelationalStoreDistributedJsunit.test.js
+39
-8
未找到文件。
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreDistributedJsunit.test.js
浏览文件 @
473e6006
...
...
@@ -63,6 +63,21 @@ try {
expect
(
null
).
assertFail
()
}
}
async
function
executeSql3
()
{
let
sqlStatement
=
"
CREATE TABLE IF NOT EXISTS test (
"
+
"
id INTEGER PRIMARY KEY AUTOINCREMENT,
"
+
"
name TEXT NOT NULL,
"
+
"
price REAL,
"
+
"
vendor INTEGER,
"
+
"
describe TEXT)
"
try
{
await
rdbStore
.
executeSql
(
sqlStatement
,
null
)
console
.
info
(
TAG
+
"
create table product success
"
)
}
catch
(
err
)
{
console
.
info
(
TAG
+
"
create table product failed
"
)
expect
(
null
).
assertFail
()
}
}
function
storeObserver
(
devices
)
{
console
.
info
(
TAG
+
devices
+
"
dataChange
"
);
...
...
@@ -73,23 +88,24 @@ export default function relationalStoreDistributedTest() {
describe
(
'
relationalStoreDistributedTest
'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
rdbStore
=
await
data_Rdb
.
getRdbStore
(
context
,
config
);
console
.
info
(
TAG
+
"
create RelationalStore store success
"
)
await
executeSql1
()
await
executeSql2
()
})
beforeEach
(
async
function
()
{
console
.
info
(
TAG
+
'
beforeEach
'
)
rdbStore
=
await
data_Rdb
.
getRdbStore
(
context
,
config
);
console
.
info
(
TAG
+
"
create RelationalStore store success
"
)
await
executeSql1
();
await
executeSql2
();
await
executeSql3
();
})
afterEach
(
async
function
()
{
console
.
info
(
TAG
+
'
afterEach
'
)
await
data_Rdb
.
deleteRdbStore
(
context
,
STORE_NAME
);
})
afterAll
(
async
function
()
{
console
.
info
(
TAG
+
'
afterAll
'
)
await
data_Rdb
.
deleteRdbStore
(
context
,
STORE_NAME
);
})
console
.
info
(
TAG
+
"
*************Unit Test Begin*************
"
);
...
...
@@ -181,15 +197,20 @@ describe('relationalStoreDistributedTest', function () {
*/
it
(
'
testRdbStoreDistributed0006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStoreDistributed006 start *************
"
);
const
record
=
{
const
record1
=
{
"
name
"
:
"
Jim
"
,
"
age
"
:
20
,
}
const
record2
=
{
"
name
"
:
"
Jim
"
,
"
age
"
:
30
,
}
await
rdbStore
.
insert
(
"
employee
"
,
record1
);
try
{
let
predicate
=
new
data_Rdb
.
RdbPredicates
(
"
employee
"
);
predicate
.
equalTo
(
"
id
"
,
1
);
try
{
let
rowId
=
await
rdbStore
.
update
(
record
,
predicate
);
let
rowId
=
await
rdbStore
.
update
(
record
2
,
predicate
);
console
.
info
(
TAG
+
"
update one record success
"
+
rowId
)
expect
(
1
).
assertEqual
(
rowId
)
}
catch
(
err
)
{
...
...
@@ -211,6 +232,11 @@ describe('relationalStoreDistributedTest', function () {
*/
it
(
'
testRdbStoreDistributed0007
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStoreDistributed0007 start *************
"
);
const
record1
=
{
"
name
"
:
"
Jim
"
,
"
age
"
:
30
,
}
await
rdbStore
.
insert
(
"
employee
"
,
record1
);
try
{
let
predicates
=
new
data_Rdb
.
RdbPredicates
(
"
employee
"
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
...
...
@@ -245,6 +271,11 @@ describe('relationalStoreDistributedTest', function () {
*/
it
(
'
testRdbStoreDistributed0008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStoreDistributed0008 start *************
"
);
const
record1
=
{
"
name
"
:
"
Jim
"
,
"
age
"
:
20
,
}
await
rdbStore
.
insert
(
"
employee
"
,
record1
);
let
predicates
=
new
data_Rdb
.
RdbPredicates
(
"
employee
"
)
try
{
let
number
=
await
rdbStore
.
delete
(
predicates
)
...
...
@@ -644,7 +675,7 @@ describe('relationalStoreDistributedTest', function () {
*/
it
(
'
SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_026
'
,
0
,
async
function
(
done
)
{
try
{
await
rdbStore
.
setDistributedTables
([
'
employee
'
],
data_Rdb
.
DistributedType
.
DISTRIBUTED_CLOUD
,
function
(
err
){
await
rdbStore
.
setDistributedTables
([
'
test
'
],
data_Rdb
.
DistributedType
.
DISTRIBUTED_CLOUD
,
function
(
err
){
if
(
err
)
{
console
.
error
(
TAG
+
`SetDistributedTables failed, code is
${
err
.
code
}
,message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录