Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dacfa008
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看板
提交
dacfa008
编写于
8月 19, 2021
作者:
Y
yangzhouwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify storage js unit.
Signed-off-by:
N
yangzhouwei
<
yangzhouwei1@huawei.com
>
上级
fc180e3f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
208 addition
and
41 deletion
+208
-41
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageCallBackJsunit.test.js
.../hap/entry/src/main/js/test/StorageCallBackJsunit.test.js
+54
-2
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageHelperJsunit.test.js
...st/hap/entry/src/main/js/test/StorageHelperJsunit.test.js
+9
-2
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StoragePromiseJsunit.test.js
...t/hap/entry/src/main/js/test/StoragePromiseJsunit.test.js
+74
-6
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageSyncJsunit.test.js
...test/hap/entry/src/main/js/test/StorageSyncJsunit.test.js
+71
-31
未找到文件。
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageCallBackJsunit.test.js
浏览文件 @
dacfa008
...
...
@@ -49,9 +49,9 @@ describe('storageTest', function () {
})
/**
* @tc.name has callback interface test
* @tc.name has
string
callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0020
* @tc.desc has callback interface test
* @tc.desc has
string
callback interface test
*/
it
(
'
testHasKey0032
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_STRING_ELEMENT
,
"
test
"
);
...
...
@@ -61,6 +61,58 @@ describe('storageTest', function () {
done
();
})
/**
* @tc.name has int callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0130
* @tc.desc has int callback interface test
*/
it
(
'
testHasKey0033
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_INT_ELEMENT
,
1
);
await
mPref
.
has
(
KEY_TEST_INT_ELEMENT
,
function
(
err
,
ret
)
{
expect
(
true
).
assertEqual
(
ret
);
})
done
();
})
/**
* @tc.name has float callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0140
* @tc.desc has float callback interface test
*/
it
(
'
testHasKey0034
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_FLOAT_ELEMENT
,
1.1
);
await
mPref
.
has
(
KEY_TEST_FLOAT_ELEMENT
,
function
(
err
,
ret
)
{
expect
(
true
).
assertEqual
(
ret
);
})
done
();
})
/**
* @tc.name has long callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0150
* @tc.desc has long callback interface test
*/
it
(
'
testHasKey0035
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_LONG_ELEMENT
,
0
);
await
mPref
.
has
(
KEY_TEST_LONG_ELEMENT
,
function
(
err
,
ret
)
{
expect
(
true
).
assertEqual
(
ret
);
})
done
();
})
/**
* @tc.name has boolean callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0160
* @tc.desc has boolean callback interface test
*/
it
(
'
testHasKey0036
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
await
mPref
.
has
(
KEY_TEST_BOOLEAN_ELEMENT
,
function
(
err
,
ret
)
{
expect
(
true
).
assertEqual
(
ret
);
})
done
();
})
/**
* @tc.name get defaultValue callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0030
...
...
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageHelperJsunit.test.js
浏览文件 @
dacfa008
// @ts-nocheck
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -68,12 +69,14 @@ describe('storageTest', function () {
*/
it
(
'
testRemoveStorageFromCache001
'
,
0
,
function
()
{
let
perf
=
storage
.
getStorageSync
(
'
/data/test_storage1
'
);
perf
=
null
;
perf
.
putSync
(
'
test
'
,
2
)
;
try
{
storage
.
removeStorageFromCacheSync
(
'
/data/test_storage1
'
);
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
}
var
value
=
mPref
.
getSync
(
'
test
'
,
0
);
expect
(
value
).
assertEqual
(
0
);
})
/**
...
...
@@ -100,12 +103,16 @@ describe('storageTest', function () {
*/
it
(
'
testDeleteStorageHelper001
'
,
0
,
function
()
{
let
perf
=
storage
.
getStorageSync
(
'
/data/test_storage3
'
);
perf
=
null
;
try
{
storage
.
deleteStorageSync
(
'
/data/test_storage3
'
);
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
}
try
{
perf
.
putSync
(
"
int
"
,
3
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
}
})
/**
...
...
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StoragePromiseJsunit.test.js
浏览文件 @
dacfa008
...
...
@@ -53,9 +53,9 @@ describe('storageTest', function () {
})
/**
* @tc.name has
promise
interface test
* @tc.name has
string
interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0020
* @tc.desc has
promise
interface test
* @tc.desc has
string
interface test
*/
it
(
'
testHasKey0031
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_STRING_ELEMENT
,
"
test
"
);
...
...
@@ -70,9 +70,77 @@ describe('storageTest', function () {
})
/**
* @tc.name get defalut promise interface test
* @tc.name has int interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0140
* @tc.desc has int interface test
*/
it
(
'
testHasKey0032
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_INT_ELEMENT
,
1
);
const
promise
=
mPref
.
has
(
KEY_TEST_INT_ELEMENT
);
promise
.
then
((
ret
)
=>
{
expect
(
true
).
assertEqual
(
ret
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
})
/**
* @tc.name has float interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0150
* @tc.desc has float interface test
*/
it
(
'
testHasKey0033
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_FLOAT_ELEMENT
,
2.0
);
const
promise
=
mPref
.
has
(
KEY_TEST_FLOAT_ELEMENT
);
promise
.
then
((
ret
)
=>
{
expect
(
true
).
assertEqual
(
ret
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
})
/**
* @tc.name has boolean interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0160
* @tc.desc has boolean interface test
*/
it
(
'
testHasKey0034
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
const
promise
=
mPref
.
has
(
KEY_TEST_BOOLEAN_ELEMENT
);
promise
.
then
((
ret
)
=>
{
expect
(
true
).
assertEqual
(
ret
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
})
/**
* @tc.name has long interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0170
* @tc.desc has long interface test
*/
it
(
'
testHasKey0035
'
,
0
,
async
function
(
done
)
{
mPref
.
putSync
(
KEY_TEST_LONG_ELEMENT
,
0
);
const
promise
=
mPref
.
has
(
KEY_TEST_LONG_ELEMENT
);
promise
.
then
((
ret
)
=>
{
expect
(
true
).
assertEqual
(
ret
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
})
/**
* @tc.name get string promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0030
* @tc.desc
deleteStorag
e interface test
* @tc.desc
get string promis
e interface test
*/
it
(
'
testGetDefValue0061
'
,
0
,
async
function
(
done
)
{
mPref
.
clearSync
();
...
...
@@ -160,9 +228,9 @@ describe('storageTest', function () {
})
/**
* @tc.name
get String
promise interface test
* @tc.name
put boolean
promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0090
* @tc.desc
get String
promise interface test
* @tc.desc
put boolean
promise interface test
*/
it
(
'
testPutBoolean0121
'
,
0
,
async
function
(
done
)
{
mPref
.
clearSync
();
...
...
distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageSyncJsunit.test.js
浏览文件 @
dacfa008
...
...
@@ -54,9 +54,9 @@ describe('storageTest', function () {
})
/**
* @tc.name
has sync inte
face test
* @tc.name
put string sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0020
* @tc.desc
has sync inte
face test
* @tc.desc
put string sync inter
face test
*/
it
(
'
testHasKey003
'
,
0
,
function
()
{
mPref
.
putSync
(
KEY_TEST_STRING_ELEMENT
,
"
test
"
);
...
...
@@ -64,19 +64,59 @@ describe('storageTest', function () {
})
/**
* @tc.name get boolean sync inteface test
* @tc.name put int sync interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0170
* @tc.desc put int sync interface test
*/
it
(
'
testHasKey004
'
,
0
,
function
()
{
mPref
.
putSync
(
KEY_TEST_INT_ELEMENT
,
1
);
expect
(
true
).
assertEqual
(
mPref
.
hasSync
(
KEY_TEST_INT_ELEMENT
));
})
/**
* @tc.name put boolean sync interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0180
* @tc.desc put boolean sync interface test
*/
it
(
'
testHasKey005
'
,
0
,
function
()
{
mPref
.
putSync
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
expect
(
true
).
assertEqual
(
mPref
.
hasSync
(
KEY_TEST_BOOLEAN_ELEMENT
));
})
/**
* @tc.name put long sync interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0190
* @tc.desc put long sync interface test
*/
it
(
'
testHasKey006
'
,
0
,
function
()
{
mPref
.
putSync
(
KEY_TEST_LONG_ELEMENT
,
0
);
expect
(
true
).
assertEqual
(
mPref
.
hasSync
(
KEY_TEST_LONG_ELEMENT
));
})
/**
* @tc.name put float sync interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0200
* @tc.desc put float sync interface test
*/
it
(
'
testHasKey007
'
,
0
,
function
()
{
mPref
.
putSync
(
KEY_TEST_FLOAT_ELEMENT
,
1.1
);
expect
(
true
).
assertEqual
(
mPref
.
hasSync
(
KEY_TEST_FLOAT_ELEMENT
));
})
/**
* @tc.name put boolean sync interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0030
* @tc.desc
get boolean sync inte
face test
* @tc.desc
put boolean sync inter
face test
*/
it
(
'
testGetBoolean005
'
,
0
,
function
()
{
mPref
.
putSync
(
KEY_TEST_
BOOLEAN
_ELEMENT
,
true
);
expect
(
true
).
assertEqual
(
mPref
.
hasSync
(
KEY_TEST_
BOOLEAN
_ELEMENT
));
mPref
.
putSync
(
KEY_TEST_
LONG
_ELEMENT
,
true
);
expect
(
true
).
assertEqual
(
mPref
.
hasSync
(
KEY_TEST_
LONG
_ELEMENT
));
})
/**
* @tc.name get defa
ltValue sync inte
face test
* @tc.name get defa
ultValue sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0040
* @tc.desc get defa
ltValue sync inte
face test
* @tc.desc get defa
ultValue sync inter
face test
*/
it
(
'
testGetDefValue006
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -88,32 +128,32 @@ describe('storageTest', function () {
})
/**
* @tc.name
get float sync inte
face test
* @tc.name
put float sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0050
* @tc.desc
get float sync inte
face test
* @tc.desc
put float sync inter
face test
*/
it
(
'
testGetFloat007
'
,
0
,
function
()
{
mPref
.
clearSync
();
mPref
.
putSync
(
KEY_TEST_FLOAT_ELEMENT
,
3.0
);
expect
(
3.0
).
assertEqual
(
mPref
.
getSync
(
KEY_TEST_FLOAT_ELEMENT
,
0.0
)
,
0
);
expect
(
0.0
).
assertEqual
(
mPref
.
getSync
(
KEY_TEST_STRING_ELEMENT
,
0.0
)
,
0
);
expect
(
3.0
).
assertEqual
(
mPref
.
getSync
(
KEY_TEST_FLOAT_ELEMENT
,
0.0
));
expect
(
0.0
).
assertEqual
(
mPref
.
getSync
(
KEY_TEST_STRING_ELEMENT
,
0.0
));
})
/**
* @tc.name
get int sync inte
face test
* @tc.name
put int sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0060
* @tc.desc
get int sync inte
face test
* @tc.desc
put int sync inter
face test
*/
it
(
'
testGetInt008
'
,
0
,
function
()
{
mPref
.
clearSync
();
mPref
.
putSync
(
KEY_TEST_INT_ELEMENT
,
3
);
expect
(
3
).
assertEqual
(
mPref
.
getSync
(
KEY_TEST_INT_ELEMENT
,
0.0
)
,
0
);
expect
(
3
).
assertEqual
(
mPref
.
getSync
(
KEY_TEST_INT_ELEMENT
,
0.0
));
})
/**
* @tc.name
get long sync inte
face test
* @tc.name
put long sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0070
* @tc.desc
get long sync inte
face test
* @tc.desc
put long sync inter
face test
*/
it
(
'
testGetLong009
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -123,9 +163,9 @@ describe('storageTest', function () {
})
/**
* @tc.name
get String sync inte
face test
* @tc.name
put String & int sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0080
* @tc.desc
get String sync inte
face test
* @tc.desc
put String & int sync inter
face test
*/
it
(
'
testGetString10
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -137,9 +177,9 @@ describe('storageTest', function () {
})
/**
* @tc.name put
float sync inte
face test
* @tc.name put
boolean sync inter
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0090
* @tc.desc put
float sync inte
face test
* @tc.desc put
boolean sync inter
face test
*/
it
(
'
testPutBoolean012
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -150,9 +190,9 @@ describe('storageTest', function () {
})
/**
* @tc.name put float sync inteface test
* @tc.name put float sync inte
r
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0100
* @tc.desc put float sync inteface test
* @tc.desc put float sync inte
r
face test
*/
it
(
'
testPutFloat013
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -163,9 +203,9 @@ describe('storageTest', function () {
})
/**
* @tc.name put int sync inteface test
* @tc.name put int sync inte
r
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0110
* @tc.desc put int sync inteface test
* @tc.desc put int sync inte
r
face test
*/
it
(
'
testPutInt014
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -176,9 +216,9 @@ describe('storageTest', function () {
})
/**
* @tc.name put long sync inteface test
* @tc.name put long sync inte
r
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0120
* @tc.desc put long sync inteface test
* @tc.desc put long sync inte
r
face test
*/
it
(
'
testPutLong015
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -189,9 +229,9 @@ describe('storageTest', function () {
})
/**
* @tc.name put String sync inteface test
* @tc.name put String sync inte
r
face test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0130
* @tc.desc put String sync inteface test
* @tc.desc put String sync inte
r
face test
*/
it
(
'
testPutString016
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
@@ -203,9 +243,9 @@ describe('storageTest', function () {
})
/**
* @tc.name
on
interface test
* @tc.name
put
interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0140
* @tc.desc
on
interface test
* @tc.desc
put
interface test
*/
it
(
'
testRegisterObserver001
'
,
0
,
function
()
{
mPref
.
clearSync
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录