Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4601d0a3
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看板
提交
4601d0a3
编写于
5月 23, 2022
作者:
B
bayanxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
分布式数据库用例修正
Signed-off-by:
N
bayanxing
<
bayanxing@kaihongdigi.com
>
上级
5e4739fb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
47 addition
and
255 deletion
+47
-255
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js
.../src/main/js/default/test/KvManagerCallbackJsunit.test.js
+29
-104
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js
...p/src/main/js/default/test/KvManagerPromiseJsunit.test.js
+18
-151
未找到文件。
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js
浏览文件 @
4601d0a3
...
@@ -21,7 +21,6 @@ const STORE_KEY = 'key_test_string';
...
@@ -21,7 +21,6 @@ const STORE_KEY = 'key_test_string';
const
STORE_VALUE
=
'
value-test-string
'
;
const
STORE_VALUE
=
'
value-test-string
'
;
var
kvManager
=
null
;
var
kvManager
=
null
;
var
kvStore
=
null
;
var
kvStore
=
null
;
var
kvStoreNew
=
null
;
describe
(
'
KVManagerCallbackTest
'
,
function
()
{
describe
(
'
KVManagerCallbackTest
'
,
function
()
{
const
config
=
{
const
config
=
{
...
@@ -46,11 +45,8 @@ describe('KVManagerCallbackTest', function () {
...
@@ -46,11 +45,8 @@ describe('KVManagerCallbackTest', function () {
console
.
log
(
'
beforeAll
'
);
console
.
log
(
'
beforeAll
'
);
await
factory
.
createKVManager
(
config
,
function
(
err
,
manager
)
{
await
factory
.
createKVManager
(
config
,
function
(
err
,
manager
)
{
kvManager
=
manager
;
kvManager
=
manager
;
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
,
function
(
err
,
store
)
{
kvStoreNew
=
store
;
done
();
done
();
});
});
});
console
.
log
(
'
beforeAll end
'
);
console
.
log
(
'
beforeAll end
'
);
})
})
...
@@ -442,9 +438,10 @@ describe('KVManagerCallbackTest', function () {
...
@@ -442,9 +438,10 @@ describe('KVManagerCallbackTest', function () {
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
'
testKVManagerGetKVStore113 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore113 getKVStore success
'
);
expect
(
null
).
assertFail
();
expect
(
(
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
}
else
{
}
else
{
console
.
log
(
'
testKVManagerGetKVStore113 getKVStore fail
'
);
console
.
log
(
'
testKVManagerGetKVStore113 getKVStore fail
'
);
expect
(
null
).
assertFail
();
}
}
done
();
done
();
});
});
...
@@ -483,7 +480,7 @@ describe('KVManagerCallbackTest', function () {
...
@@ -483,7 +480,7 @@ describe('KVManagerCallbackTest', function () {
done
();
done
();
}
}
})
})
F
/**
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1150
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1150
* @tc.name [JS-API8]KVManager.GetKVStore.
* @tc.name [JS-API8]KVManager.GetKVStore.
...
@@ -503,13 +500,12 @@ describe('KVManagerCallbackTest', function () {
...
@@ -503,13 +500,12 @@ describe('KVManagerCallbackTest', function () {
try
{
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerGetKVStore115 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore115 getKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
expect
(
null
).
assertFail
();
kvStore
=
store
;
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerGetKVStore115 getKVStore e
'
+
e
);
console
.
log
(
'
testKVManagerGetKVStore115 getKVStore e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -533,13 +529,12 @@ describe('KVManagerCallbackTest', function () {
...
@@ -533,13 +529,12 @@ describe('KVManagerCallbackTest', function () {
try
{
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerGetKVStore116 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore116 getKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
expect
(
null
).
assertFail
();
kvStore
=
store
;
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerGetKVStore116 getKVStore e
'
+
e
);
console
.
log
(
'
testKVManagerGetKVStore116 getKVStore e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -563,13 +558,12 @@ describe('KVManagerCallbackTest', function () {
...
@@ -563,13 +558,12 @@ describe('KVManagerCallbackTest', function () {
try
{
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerGetKVStore117 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore117 getKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
expect
(
null
).
assertFail
();
kvStore
=
store
;
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerGetKVStore117 getKVStore e
'
+
e
);
console
.
log
(
'
testKVManagerGetKVStore117 getKVStore e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -593,13 +587,12 @@ describe('KVManagerCallbackTest', function () {
...
@@ -593,13 +587,12 @@ describe('KVManagerCallbackTest', function () {
try
{
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerGetKVStore118 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore118 getKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
expect
(
null
).
assertFail
();
kvStore
=
store
;
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerGetKVStore118 getKVStore e
'
+
e
);
console
.
log
(
'
testKVManagerGetKVStore118 getKVStore e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -623,13 +616,12 @@ describe('KVManagerCallbackTest', function () {
...
@@ -623,13 +616,12 @@ describe('KVManagerCallbackTest', function () {
try
{
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerGetKVStore119 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore119 getKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
expect
(
null
).
assertFail
();
kvStore
=
store
;
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerGetKVStore119 getKVStore e
'
+
e
);
console
.
log
(
'
testKVManagerGetKVStore119 getKVStore e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -653,13 +645,12 @@ describe('KVManagerCallbackTest', function () {
...
@@ -653,13 +645,12 @@ describe('KVManagerCallbackTest', function () {
try
{
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
,
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerGetKVStore120 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore120 getKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
store
!=
null
)).
assertTrue
();
expect
(
null
).
assertFail
();
kvStore
=
store
;
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerGetKVStore119 getKVStore e
'
+
e
);
console
.
log
(
'
testKVManagerGetKVStore119 getKVStore e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
done
();
done
();
}
}
})
})
...
@@ -923,7 +914,10 @@ describe('KVManagerCallbackTest', function () {
...
@@ -923,7 +914,10 @@ describe('KVManagerCallbackTest', function () {
it
(
'
testKVStorePut100
'
,
0
,
async
function
(
done
)
{
it
(
'
testKVStorePut100
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVStorePut100
'
);
console
.
log
(
'
testKVStorePut100
'
);
try
{
try
{
await
kvStoreNew
.
put
(
STORE_KEY
,
STORE_VALUE
,
function
(
err
,
data
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
,
async
function
(
err
,
store
)
{
console
.
log
(
'
testKVStorePut100 getKVStore success
'
);
kvStore
=
store
;
await
kvStore
.
put
(
STORE_KEY
,
STORE_VALUE
,
function
(
err
,
data
)
{
if
(
err
!=
undefined
){
if
(
err
!=
undefined
){
console
.
log
(
'
testKVStorePut100 put callback fail
'
);
console
.
log
(
'
testKVStorePut100 put callback fail
'
);
}
else
{
}
else
{
...
@@ -932,91 +926,22 @@ describe('KVManagerCallbackTest', function () {
...
@@ -932,91 +926,22 @@ describe('KVManagerCallbackTest', function () {
}
}
done
();
done
();
});
});
}
catch
(
e
)
{
console
.
log
(
'
testKVStorePut100 callback e
'
+
e
);
done
();
}
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_DELETE_1000
* @tc.name [JS-API8]KVStore.Delete
* @tc.desc Test Js Api KVManager.Delete testcase 100
*/
it
(
'
testKVStoreDelete100
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVStoreDelete100
'
);
try
{
await
KVStoreNew
.
put
(
STORE_KEY
,
STORE_VALUE
,
async
function
(
err
,
data
)
{
console
.
log
(
'
testKVStoreDelete100 put success
'
);
try
{
kvStore
.
delete
(
STORE_KEY
,
function
(
err
,
data
)
{
if
(
err
==
undefined
)
{
console
.
log
(
'
testKVStoreDelete100 callback delete success
'
);
expect
(
null
).
assertFail
();
}
else
{
console
.
log
(
'
testKVStoreDelete100 callback delete fail
'
);
}
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testKVStoreDelete100 callback delete e
'
+
e
);
console
.
log
(
'
testKVStorePut100 callback e
'
+
e
);
done
();
}
});
}
catch
(
ee
)
{
console
.
log
(
'
testKVStoreDelete100 callback delete ee
'
+
ee
);
expect
(
null
).
assertFail
();
done
();
done
();
}
}
})
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_ON_1000
* @tc.name [JS-API8]KVStore.On
* @tc.desc Test Js Api KVManager.On testcase 100
*/
it
(
'
testKVStoreOn100
'
,
0
,
async
function
(
done
)
{
kvStoreNew
.
on
(
'
dataChange
'
,
0
,
function
(
data
)
{
console
.
log
(
"
testKVStoreOn100 callback call data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
();
});
done
();
})
/**
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_ON_1100
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_ON_1100
* @tc.name [JS-API8]KVStore.On
* @tc.name [JS-API8]KVStore.On
* @tc.desc Test Js Api KVManager.On testcase 101
* @tc.desc Test Js Api KVManager.On testcase 101
*/
*/
it
(
'
testKVStoreOn101
'
,
0
,
async
function
(
done
)
{
it
(
'
testKVStoreOn101
'
,
0
,
async
function
(
done
)
{
kvStoreNew
.
on
(
'
dataChange
'
,
1
,
function
(
data
)
{
console
.
log
(
"
testKVStoreOn101 callback call data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_ON_1200
* @tc.name [JS-API8]KVStore.On
* @tc.desc Test Js Api KVManager.On testcase 102
*/
it
(
'
testKVStoreOn102
'
,
0
,
async
function
(
done
)
{
kvStoreNew
.
on
(
'
dataChange
'
,
2
,
function
(
data
)
{
console
.
log
(
"
testKVStoreOn102 callback call data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_ON_1300
* @tc.name [JS-API8]KVStore.On
* @tc.desc Test Js Api KVManager.On testcase 103
*/
it
(
'
testKVStoreOn103
'
,
0
,
async
function
(
done
)
{
kvStoreNew
.
on
(
'
syncComplete
'
,
function
(
data
)
{
kvStoreNew
.
on
(
'
syncComplete
'
,
function
(
data
)
{
console
.
log
(
"
testKVStoreOn10
3
callback call data:
"
+
data
);
console
.
log
(
"
testKVStoreOn10
1
callback call data:
"
+
data
);
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js
浏览文件 @
4601d0a3
...
@@ -441,11 +441,10 @@ describe('KVManagerPromiseTest', function () {
...
@@ -441,11 +441,10 @@ describe('KVManagerPromiseTest', function () {
}
}
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore014 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore014 getKVStore success
'
);
kvStore
=
store
;
expect
(
null
).
assertFail
();
expect
(
store
!=
null
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore014 getKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerGetKVStore014 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
})
})
...
@@ -468,11 +467,10 @@ describe('KVManagerPromiseTest', function () {
...
@@ -468,11 +467,10 @@ describe('KVManagerPromiseTest', function () {
}
}
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore015 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore015 getKVStore success
'
);
kvStore
=
store
;
expect
(
null
).
assertFail
();
expect
(
store
!=
null
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore015 getKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerGetKVStore015 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
})
})
...
@@ -495,11 +493,10 @@ describe('KVManagerPromiseTest', function () {
...
@@ -495,11 +493,10 @@ describe('KVManagerPromiseTest', function () {
}
}
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore016 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore016 getKVStore success
'
);
kvStore
=
store
;
expect
(
null
).
assertFail
();
expect
(
store
!=
null
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore016 getKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerGetKVStore016 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
})
})
...
@@ -522,11 +519,10 @@ describe('KVManagerPromiseTest', function () {
...
@@ -522,11 +519,10 @@ describe('KVManagerPromiseTest', function () {
}
}
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore017 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore017 getKVStore success
'
);
kvStore
=
store
;
expect
(
null
).
assertFail
();
expect
(
store
!=
null
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore017 getKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerGetKVStore017 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
})
})
...
@@ -549,11 +545,10 @@ describe('KVManagerPromiseTest', function () {
...
@@ -549,11 +545,10 @@ describe('KVManagerPromiseTest', function () {
}
}
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore018 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore018 getKVStore success
'
);
kvStore
=
store
;
expect
(
null
).
assertFail
();
expect
(
store
!=
null
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore018 getKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerGetKVStore018 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
})
})
...
@@ -576,11 +571,10 @@ describe('KVManagerPromiseTest', function () {
...
@@ -576,11 +571,10 @@ describe('KVManagerPromiseTest', function () {
}
}
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
optionsInfo
).
then
((
store
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore019 getKVStore success
'
);
console
.
log
(
'
testKVManagerGetKVStore019 getKVStore success
'
);
kvStore
=
store
;
expect
(
null
).
assertFail
();
expect
(
store
!=
null
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerGetKVStore019 getKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerGetKVStore019 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
expect
(
true
).
assertTrue
();
});
});
done
();
done
();
})
})
...
@@ -591,95 +585,18 @@ describe('KVManagerPromiseTest', function () {
...
@@ -591,95 +585,18 @@ describe('KVManagerPromiseTest', function () {
* @tc.desc Test Js Api KVManager.CloseKVStore testcase 001
* @tc.desc Test Js Api KVManager.CloseKVStore testcase 001
*/
*/
it
(
'
testKVManagerCloseKVStore001
'
,
0
,
async
function
(
done
)
{
it
(
'
testKVManagerCloseKVStore001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerCloseKVStore001
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
).
then
(
async
(
store
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore001 getKVStore success
'
);
kvStore
=
store
;
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
).
then
(()
=>
{
console
.
log
(
'
testKVManagerCloseKVStore001 closeKVStore success
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore001 closeKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore001 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0200
* @tc.name [JS-API8]KVManager.CloseKVStore.
* @tc.desc Test Js Api KVManager.CloseKVStore testcase 002
*/
it
(
'
testKVManagerCloseKVStore002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerCloseKVStore002
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
).
then
(
async
(
store
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore002 getKVStore success
'
);
kvStore
=
store
;
try
{
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
).
then
(()
=>
{
console
.
log
(
'
testKVManagerCloseKVStore002 closeKVStore success
'
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore002 closeKVStore err
'
+
err
);
});
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerCloseKVStore002 closeKVStore e
'
+
e
);
}
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore002 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0300
* @tc.name [JS-API8]KVManager.CloseKVStore.
* @tc.desc Test Js Api KVManager.CloseKVStore testcase 003
*/
it
(
'
testKVManagerCloseKVStore003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerCloseKVStore003
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
).
then
(
async
(
store
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore003 getKVStore success
'
);
kvStore
=
store
;
try
{
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
testKVManagerCloseKVStore003 closeKVStore success
'
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore003 closeKVStore err
'
+
err
);
});
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerCloseKVStore003 closeKVStore e
'
+
e
);
}
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore003 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_CLOSEKVSTORE_0400
* @tc.name [JS-API8]KVManager.CloseKVStore.
* @tc.desc Test Js Api KVManager.CloseKVStore testcase 004
*/
it
(
'
testKVManagerCloseKVStore004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerCloseKVStore004
'
);
console
.
log
(
'
testKVManagerCloseKVStore004
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
,
async
function
(
err
,
store
)
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
,
async
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerCloseKVStore00
4
getKVStore success
'
);
console
.
log
(
'
testKVManagerCloseKVStore00
1
getKVStore success
'
);
kvStore
=
store
;
kvStore
=
store
;
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
);
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
);
});
});
console
.
log
(
'
testKVManagerCloseKVStore
104
closeKVStore redo.
'
);
console
.
log
(
'
testKVManagerCloseKVStore
001
closeKVStore redo.
'
);
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
).
then
(()
=>
{
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
).
then
(()
=>
{
console
.
log
(
'
testKVManagerCloseKVStore00
4
closeKVStore twice
'
);
console
.
log
(
'
testKVManagerCloseKVStore00
1
closeKVStore twice
'
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore00
4
closeKVStore twice err
'
+
err
);
console
.
log
(
'
testKVManagerCloseKVStore00
1
closeKVStore twice err
'
+
err
);
});
});
done
();
done
();
})
})
...
@@ -691,61 +608,11 @@ describe('KVManagerPromiseTest', function () {
...
@@ -691,61 +608,11 @@ describe('KVManagerPromiseTest', function () {
*/
*/
it
(
'
testKVManagerDeleteKVStore001
'
,
0
,
async
function
(
done
)
{
it
(
'
testKVManagerDeleteKVStore001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerDeleteKVStore001
'
);
console
.
log
(
'
testKVManagerDeleteKVStore001
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
).
then
(
async
(
store
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore001 getKVStore success
'
);
kvStore
=
store
;
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore001 deleteKVStore success
'
);
console
.
log
(
'
testKVManagerDeleteKVStore001 deleteKVStore success
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore001 deleteKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore001 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_0200
* @tc.name [JS-API8]KVManager.DeleteKVStore.
* @tc.desc Test Js Api KVManager.DeleteKVStore testcase 002
*/
it
(
'
testKVManagerDeleteKVStore002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerDeleteKVStore002
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
).
then
(
async
(
store
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore002 getKVStore success
'
);
kvStore
=
store
;
try
{
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
).
then
(()
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore002 deleteKVStore success
'
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore002 deleteKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerDeleteKVStore001 deleteKVStore err
'
+
err
);
});
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerDeleteKVStore002 deleteKVStore e
'
+
e
);
}
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore002 getKVStore err
'
+
err
);
expect
(
null
).
assertFail
();
});
done
();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_DELETEKVSTORE_0300
* @tc.name [JS-API8]KVManager.DeleteKVStore.
* @tc.desc Test Js Api KVManager.DeleteKVStore testcase 003
*/
it
(
'
testKVManagerDeleteKVStore003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerDeleteKVStore003
'
);
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore003 deleteKVStore success
'
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerDeleteKVStore003 deleteKVStore err
'
+
err
);
});
});
done
();
done
();
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录