Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
889778b6
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
889778b6
编写于
6月 18, 2022
作者:
Y
yanglifeng1217
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<yanglifeng5@huawei.com>
Signed-off-by:
N
yanglifeng1217
<
yanglifeng5@huawei.com
>
上级
7b70407f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
100 addition
and
0 deletion
+100
-0
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbStoreDistributedJsunit.test.js
...rc/main/js/default/test/RdbStoreDistributedJsunit.test.js
+57
-0
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageHelperJsunit.test.js
.../hap/src/main/js/default/test/StorageHelperJsunit.test.js
+43
-0
未找到文件。
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbStoreDistributedJsunit.test.js
浏览文件 @
889778b6
...
...
@@ -309,6 +309,27 @@ describe('rdbStoreDistributedTest', function () {
done
();
console
.
log
(
TAG
+
"
************* testRdbStoreDistributed0011 end *************
"
);
})
/**
* @tc.name sync Callback test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_Callback_011
* @tc.desc sync Callback test
*/
it
(
'
testRdbStoreDistributedCallback0011
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testRdbStoreDistributedCallback0011 start *************
"
);
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
employee
"
)
predicates
=
predicates
.
inDevices
(
"
12345678abcd
"
);
rdbStore
.
sync
(
dataRdb
.
SyncMode
.
SYNC_MODE_PUSH
,
predicates
,(
err
,
ret
)
=>
{
console
.
log
(
TAG
+
"
sync push success
"
);
expect
(
rdbStore
).
assertEqual
(
rdbStore
);
});
rdbStore
.
sync
(
dataRdb
.
SyncMode
.
SYNC_MODE_PULL
,
predicates
,(
err
,
ret
)
=>
{
console
.
log
(
TAG
+
"
sync push success
"
);
expect
(
rdbStore
).
assertEqual
(
rdbStore
);
});
done
();
console
.
log
(
TAG
+
"
************* testRdbStoreDistributedCallback0011 end *************
"
);
})
/**
* @tc.name subscribe test
...
...
@@ -341,5 +362,41 @@ describe('rdbStoreDistributedTest', function () {
done
()
console
.
log
(
TAG
+
"
************* testRdbStoreDistributed0013 end *************
"
);
})
/**
* @tc.name obtainDistributedTableName Callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_014
* @tc.desc obtainDistributedTableName test
*/
it
(
'
testRdbStoreDistributed0014
'
,
0
,
async
function
(
done
){
await
rdbStore
.
obtainDistributedTableName
(
"
deviceId
"
,
"
EMPLOYEE
"
,
function
(
err
,
tableName
)
{
expect
(
err
!=
null
).
assertTrue
();
console
.
info
(
'
ObtainDistributedTableName failed, Unauthorized.
'
+
err
)
})
done
();
})
/**
* @tc.name obtainDistributedTableName Promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_015
* @tc.desc obtainDistributedTableName test
*/
it
(
'
testRdbStoreDistributed0015
'
,
0
,
async
function
(
done
){
await
dataRdb
.
deleteRdbStore
(
STORE_NAME
);
const
config
=
{
"
name
"
:
STORE_NAME
,
}
rdbStore
=
await
dataRdb
.
getRdbStore
(
config
,
1
);
let
promise
=
rdbStore
.
obtainDistributedTableName
(
"
deviceId
"
,
"
EMPLOYEE
"
)
promise
.
then
((
tableName
)
=>
{
expect
(
tableName
!=
"
EMPLOYEE
"
).
assertTrue
();
console
.
info
(
'
ObtainDistributedTableName
'
)
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
console
.
info
(
'
ObtainDistributedTableName failed, Unauthorized.
'
+
err
)
})
done
();
})
console
.
log
(
TAG
+
"
*************Unit Test End*************
"
);
})
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageHelperJsunit.test.js
浏览文件 @
889778b6
...
...
@@ -61,6 +61,21 @@ describe('storageTest', function () {
await
promise
;
done
();
})
/**
* @tc.name getStorage callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_Callback_0020
* @tc.desc getStorage callback interface test
*/
it
(
'
testGetStorageCallback0020
'
,
0
,
async
function
(
done
)
{
storage
.
getStorage
(
PATH
,(
err
,
pref
)
=>
{
pref
.
putSync
(
'
test
'
,
2
);
pref
.
flushSync
();
var
value
=
mPref
.
getSync
(
'
test
'
,
0
);
expect
(
value
).
assertEqual
(
2
);
});
done
();
})
/**
* @tc.name removeStorageFromCacheSync interface test
...
...
@@ -95,6 +110,20 @@ describe('storageTest', function () {
await
promise
;
done
();
})
/**
* @tc.name removeStorageFromCache callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_Helper_0042
* @tc.desc removeStorageFromCache callback interface test
*/
it
(
'
testRemoveStorageFromCache004
'
,
0
,
async
function
(
done
)
{
let
perf
=
storage
.
getStorageSync
(
'
/data/test_storage2
'
);
perf
=
null
;
storage
.
removeStorageFromCache
(
'
/data/test_storage2
'
,(
err
,
pref
)
=>
{
expect
(
err
==
null
).
assertTrue
();
});
done
();
})
/**
* @tc.name removeStorageFromCache callback interface test
...
...
@@ -152,4 +181,18 @@ describe('storageTest', function () {
await
promise
;
done
();
})
/**
* @tc.name deleteStorag callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_Callback_0070
* @tc.desc deleteStorage interface test
*/
it
(
'
testDeleteStoragCallback0070
'
,
0
,
async
function
(
done
)
{
let
perf
=
storage
.
getStorageSync
(
'
/data/test_storage4
'
);
perf
=
null
;
storage
.
deleteStorage
(
'
/data/test_storage4
'
,(
err
)
=>
{
expect
(
err
==
null
).
assertTrue
();
});
done
();
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录