Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
846c5141
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看板
提交
846c5141
编写于
1月 07, 2022
作者:
X
xsterling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
testcase update.
Signed-off-by:
N
xsterling
<
huangjiaqi19@huawei.com
>
上级
9c03ee37
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
406 addition
and
222 deletion
+406
-222
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js
.../main/js/default/test/DeviceKvStoreCallbackJsunit.test.js
+19
-12
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js
...c/main/js/default/test/DeviceKvStorePromiseJsunit.test.js
+13
-10
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/FieldNodeJsunit.test.js
...test/hap/src/main/js/default/test/FieldNodeJsunit.test.js
+0
-3
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js
.../src/main/js/default/test/KvManagerCallbackJsunit.test.js
+13
-5
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js
...p/src/main/js/default/test/KvManagerPromiseJsunit.test.js
+10
-3
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvStoreResultSetJsunit.test.js
...p/src/main/js/default/test/KvStoreResultSetJsunit.test.js
+5
-4
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/QueryJsunit.test.js
...grjstest/hap/src/main/js/default/test/QueryJsunit.test.js
+324
-169
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js
...rjstest/hap/src/main/js/default/test/SchemaJsunit.test.js
+1
-1
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js
.../main/js/default/test/SingleKvStoreCallbackJsunit.test.js
+10
-6
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreEnumJsunit.test.js
.../src/main/js/default/test/SingleKvStoreEnumJsunit.test.js
+1
-2
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js
...c/main/js/default/test/SingleKvStorePromiseJsunit.test.js
+10
-7
未找到文件。
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -32,6 +32,9 @@ const TEST_STORE_ID = 'storeId';
var
kvManager
=
null
;
var
kvStore
=
null
;
var
localDeviceId
=
null
;
const
USED_DEVICE_IDS
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
const
UNUSED_DEVICE_IDS
=
[];
/* add you test device-ids here */
var
syncDeviceIds
=
USED_DEVICE_IDS
.
concat
(
UNUSED_DEVICE_IDS
);
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -137,6 +140,7 @@ describe('DeviceKvStoreCallbackTest', function () {
done
();
});
});
kvStore
=
null
;
})
/**
...
...
@@ -851,22 +855,23 @@ describe('DeviceKvStoreCallbackTest', function () {
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 dataChange
'
);
expect
(
data
!=
null
).
assertTrue
();
});
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync101
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync101
'
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
);
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 no peer device :e:
'
+
e
);
expect
(
null
).
assertFail
();
}
done
();
})
...
...
@@ -882,22 +887,23 @@ describe('DeviceKvStoreCallbackTest', function () {
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 dataChange
'
);
expect
(
data
!=
null
).
assertTrue
();
});
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync101
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync101
'
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
);
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 no peer device :e:
'
+
e
);
expect
(
null
).
assertFail
();
}
done
();
})
...
...
@@ -913,22 +919,23 @@ describe('DeviceKvStoreCallbackTest', function () {
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 dataChange
'
);
expect
(
data
!=
null
).
assertTrue
();
});
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync101
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync101
'
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
);
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 no peer device :e:
'
+
e
);
expect
(
null
).
assertFail
();
}
done
();
})
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -32,6 +32,9 @@ const TEST_STORE_ID = 'storeId';
var
kvManager
=
null
;
var
kvStore
=
null
;
var
localDeviceId
=
null
;
const
USED_DEVICE_IDS
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
const
UNUSED_DEVICE_IDS
=
[];
/* add you test device-ids here */
var
syncDeviceIds
=
USED_DEVICE_IDS
.
concat
(
UNUSED_DEVICE_IDS
);
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -137,13 +140,13 @@ describe('DeviceKvStorePromiseTest', function () {
console
.
log
(
'
afterEach closeKVStore success
'
);
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
afterEach deleteKVStore success
'
);
kvStore
=
null
;
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach deleteKVStore err
'
+
err
);
});
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach closeKVStore err
'
+
err
);
});
kvStore
=
null
;
done
();
})
...
...
@@ -865,9 +868,9 @@ describe('DeviceKvStorePromiseTest', function () {
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
);
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001 sync no peer device :e:
'
+
e
);
}
...
...
@@ -897,12 +900,12 @@ describe('DeviceKvStorePromiseTest', function () {
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
);
}
catch
(
error
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 no peer device :e:
'
+
error
);
}
;
}
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put e
'
+
e
);
expect
(
null
).
assertFail
();
...
...
@@ -925,16 +928,16 @@ describe('DeviceKvStorePromiseTest', function () {
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete00
2
put failed:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete00
3
put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
);
}
catch
(
error
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 no peer device :e:
'
+
error
);
}
;
}
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 put e
'
+
e
);
expect
(
null
).
assertFail
();
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/FieldNodeJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -15,9 +15,6 @@
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
ddm
from
'
@ohos.data.distributedData
'
;
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
FieldNodeTest
'
,
function
()
{
/**
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerCallbackJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -67,6 +67,7 @@ describe('KVManagerCallbackTest', function () {
done
();
});
});
kvStore
=
null
;
})
/**
...
...
@@ -725,16 +726,23 @@ describe('KVManagerCallbackTest', function () {
it
(
'
testKVManagerCloseKVStore104
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerCloseKVStore104
'
);
try
{
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
,
async
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerCloseKVStore104 getKVStore success
'
);
kvStore
=
store
;
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
);
});
console
.
log
(
'
testKVManagerCloseKVStore104 closeKVStore redo.
'
);
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
,
function
(
err
,
data
)
{
console
.
log
(
'
testKVManagerCloseKVStore104 closeKVStore success
'
);
expect
((
err
==
undefined
)
&&
(
data
==
undefined
)).
assertTrue
();
done
();
console
.
log
(
'
testKVManagerCloseKVStore104 closeKVStore twice
'
+
err
);
if
(
err
==
undefined
)
{
expect
(
null
).
assertFail
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
testKVManagerCloseKVStore104 e
'
+
e
);
console
.
log
(
'
testKVManagerCloseKVStore104
closeKVStore twice
e
'
+
e
);
expect
(
null
).
assertFail
();
done
();
}
done
();
})
/**
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvManagerPromiseJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -73,6 +73,7 @@ describe('KVManagerPromiseTest', function () {
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach closeKVStore err
'
+
err
);
});
kvStore
=
null
;
done
();
})
...
...
@@ -659,11 +660,17 @@ describe('KVManagerPromiseTest', function () {
*/
it
(
'
testKVManagerCloseKVStore004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
testKVManagerCloseKVStore004
'
);
await
kvManager
.
getKVStore
(
TEST_STORE_ID
,
options
,
async
function
(
err
,
store
)
{
console
.
log
(
'
testKVManagerCloseKVStore004 getKVStore success
'
);
kvStore
=
store
;
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
);
});
console
.
log
(
'
testKVManagerCloseKVStore104 closeKVStore redo.
'
);
await
kvManager
.
closeKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
,
kvStore
).
then
(()
=>
{
console
.
log
(
'
testKVManagerCloseKVStore004 closeKVStore success
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore004 closeKVStore err
'
+
err
);
console
.
log
(
'
testKVManagerCloseKVStore004 closeKVStore twice
'
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
testKVManagerCloseKVStore004 closeKVStore twice err
'
+
err
);
});
done
();
})
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/KvStoreResultSetJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -120,13 +120,14 @@ describe('KvStoreResultSetTest', function() {
console
.
log
(
'
afterEach closeKVStore success
'
);
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
afterEach deleteKVStore success
'
);
kvStore
=
null
;
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach deleteKVStore err
'
+
err
);
});
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach closeKVStore err
'
+
err
);
});
kvStore
=
null
;
resultSet
=
null
;
done
();
})
...
...
@@ -581,12 +582,12 @@ describe('KvStoreResultSetTest', function() {
expect
(
moved
&&
(
resultSet
.
getPosition
()
==
0
)).
assertTrue
();
moved
=
resultSet
.
moveToPrevious
();
console
.
log
(
"
testKvStoreResultSetMoveToPrevious005 from 0 to -1 return
"
+
moved
);
expect
(
moved
).
assertFals
e
();
expect
(
moved
==
false
).
assertTru
e
();
console
.
log
(
"
testKvStoreResultSetMoveToPrevious005 from 0 to
"
+
resultSet
.
getPosition
());
expect
(
-
1
).
assertEqual
(
resultSet
.
getPosition
());
}
catch
(
e
)
{
console
.
log
(
"
testKvStoreResultSetMoveToPrevious005 fail
"
+
e
);
expect
(
null
).
assert
True
();
expect
(
null
).
assert
Fail
();
}
done
();
})
...
...
@@ -965,7 +966,7 @@ describe('KvStoreResultSetTest', function() {
expect
(
moved
).
assertTrue
();
moved
=
resultSet
.
moveToNext
();
console
.
log
(
"
testKvStoreResultSetIsAfterLast002 moveToNext moved=
"
+
moved
);
expect
(
moved
).
assertFals
e
();
expect
(
moved
==
false
).
assertTru
e
();
var
flag
=
resultSet
.
isAfterLast
();
console
.
log
(
"
testKvStoreResultSetIsAfterLast002 isAfterLast true=
"
+
flag
);
expect
(
flag
).
assertTrue
();
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/QueryJsunit.test.js
浏览文件 @
846c5141
此差异已折叠。
点击以展开。
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -136,13 +136,13 @@ describe('SchemaTest', function() {
console
.
log
(
'
afterEach closeKVStore success
'
);
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
afterEach deleteKVStore success
'
);
kvStore
=
null
;
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach deleteKVStore err
'
+
err
);
});
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach closeKVStore err
'
+
err
);
});
kvStore
=
null
;
done
();
})
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -31,6 +31,9 @@ const TEST_BUNDLE_NAME = 'ohos.acts.distributeddatamgr';
const
TEST_STORE_ID
=
'
storeId
'
;
var
kvManager
=
null
;
var
kvStore
=
null
;
const
USED_DEVICE_IDS
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
const
UNUSED_DEVICE_IDS
=
[];
/* add you test device-ids here */
var
syncDeviceIds
=
USED_DEVICE_IDS
.
concat
(
UNUSED_DEVICE_IDS
);
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -104,6 +107,7 @@ describe('SingleKvStoreCallbackTest', function () {
done
();
});
});
kvStore
=
null
;
})
/**
...
...
@@ -823,9 +827,9 @@ describe('SingleKvStoreCallbackTest', function () {
expect
(
err
==
undefined
).
assertTrue
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
}
...
...
@@ -852,9 +856,9 @@ describe('SingleKvStoreCallbackTest', function () {
expect
(
err
==
undefined
).
assertTrue
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 sync no peer device :e:
'
+
e
);
}
...
...
@@ -881,9 +885,9 @@ describe('SingleKvStoreCallbackTest', function () {
expect
(
err
==
undefined
).
assertTrue
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
,
10
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 sync no peer device :e:
'
+
e
);
}
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreEnumJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -48,7 +48,7 @@ describe('KvStoreEnumTest', function () {
var
maxValueLength
=
factory
.
Constants
.
MAX_VALUE_LENGTH
;
console
.
info
(
'
maxValueLength =
'
+
maxValueLength
);
expect
(
maxValueLength
==
4194303
).
assertTrue
();
expect
(
factory
.
Constants
.
MAX_VALUE_LENGTH
).
assertEqual
(
4194303
);
expect
(
factory
.
Constants
.
MAX_VALUE_LENGTH
).
assertEqual
(
4194303
);
})
/**
...
...
@@ -63,7 +63,6 @@ describe('KvStoreEnumTest', function () {
console
.
info
(
'
can NOT set value to MAX_VALUE_LENGTH :
'
+
e
);
expect
(
factory
.
Constants
.
MAX_VALUE_LENGTH
).
assertEqual
(
4194303
);
}
})
/**
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js
浏览文件 @
846c5141
...
...
@@ -31,6 +31,9 @@ const TEST_BUNDLE_NAME = 'ohos.acts.distributeddatamgr';
const
TEST_STORE_ID
=
'
storeId
'
;
var
kvManager
=
null
;
var
kvStore
=
null
;
const
USED_DEVICE_IDS
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
const
UNUSED_DEVICE_IDS
=
[];
/* add you test device-ids here */
var
syncDeviceIds
=
USED_DEVICE_IDS
.
concat
(
UNUSED_DEVICE_IDS
);
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -107,13 +110,13 @@ describe('SingleKvStorePromiseTest', function () {
console
.
log
(
'
afterEach closeKVStore success
'
);
await
kvManager
.
deleteKVStore
(
TEST_BUNDLE_NAME
,
TEST_STORE_ID
).
then
(()
=>
{
console
.
log
(
'
afterEach deleteKVStore success
'
);
kvStore
=
null
;
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach deleteKVStore err
'
+
err
);
});
}).
catch
((
err
)
=>
{
console
.
log
(
'
afterEach closeKVStore err
'
+
err
);
});
kvStore
=
null
;
done
();
})
...
...
@@ -835,9 +838,9 @@ describe('SingleKvStorePromiseTest', function () {
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 sync no peer device :e:
'
+
e
);
}
...
...
@@ -867,9 +870,9 @@ describe('SingleKvStorePromiseTest', function () {
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 sync no peer device :e:
'
+
e
);
}
...
...
@@ -899,9 +902,9 @@ describe('SingleKvStorePromiseTest', function () {
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
,
10
);
console
.
log
(
'
kvStore.sync to
'
+
JSON
.
stringify
(
syncDeviceIds
));
kvStore
.
sync
(
syncDeviceIds
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 sync no peer device :e:
'
+
e
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录