Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fd1732a7
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看板
提交
fd1732a7
编写于
1月 06, 2022
作者:
X
xsterling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
testcase update.
Signed-off-by:
N
xsterling
<
huangjiaqi19@huawei.com
>
上级
24459f98
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
120 addition
and
57 deletion
+120
-57
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js
.../main/js/default/test/DeviceKvStoreCallbackJsunit.test.js
+30
-24
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js
...c/main/js/default/test/DeviceKvStorePromiseJsunit.test.js
+26
-11
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js
...rjstest/hap/src/main/js/default/test/SchemaJsunit.test.js
+21
-0
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js
.../main/js/default/test/SingleKvStoreCallbackJsunit.test.js
+19
-10
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js
...c/main/js/default/test/SingleKvStorePromiseJsunit.test.js
+24
-12
未找到文件。
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStoreCallbackJsunit.test.js
浏览文件 @
fd1732a7
...
@@ -854,19 +854,21 @@ describe('DeviceKvStoreCallbackTest', function () {
...
@@ -854,19 +854,21 @@ describe('DeviceKvStoreCallbackTest', function () {
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
,
function
(
err
,
data
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 put success
'
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
try
{
kvStore
.
sync
(
devices
,
mode
);
kvStore
.
sync
(
devices
,
mode
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
}
}
done
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 no peer device :e:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 no peer device :e:
'
+
e
);
done
();
}
}
done
();
})
})
/**
/**
...
@@ -883,19 +885,21 @@ describe('DeviceKvStoreCallbackTest', function () {
...
@@ -883,19 +885,21 @@ describe('DeviceKvStoreCallbackTest', function () {
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
,
function
(
err
,
data
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 put success
'
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
try
{
kvStore
.
sync
(
devices
,
mode
);
kvStore
.
sync
(
devices
,
mode
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 sync no peer device :e:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
}
}
done
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 no peer device :e:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete102 no peer device :e:
'
+
e
);
done
();
}
}
done
();
})
})
/**
/**
...
@@ -912,19 +916,21 @@ describe('DeviceKvStoreCallbackTest', function () {
...
@@ -912,19 +916,21 @@ describe('DeviceKvStoreCallbackTest', function () {
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
,
function
(
err
,
data
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 put success
'
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
try
{
kvStore
.
sync
(
devices
,
mode
);
kvStore
.
sync
(
devices
,
mode
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 sync no peer device :e:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
}
}
done
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 no peer device :e:
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete103 no peer device :e:
'
+
e
);
done
();
}
}
done
();
})
})
/**
/**
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/DeviceKvStorePromiseJsunit.test.js
浏览文件 @
fd1732a7
...
@@ -860,14 +860,19 @@ describe('DeviceKvStorePromiseTest', function () {
...
@@ -860,14 +860,19 @@ describe('DeviceKvStorePromiseTest', function () {
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001 put success
'
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
);
kvStore
.
sync
(
devices
,
mode
);
}
).
catch
((
error
)
=>
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001
no peer device :e:
'
+
error
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001
sync no peer device :e:
'
+
e
);
}
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001
put
e
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete001 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
done
();
done
();
...
@@ -887,13 +892,18 @@ describe('DeviceKvStorePromiseTest', function () {
...
@@ -887,13 +892,18 @@ describe('DeviceKvStorePromiseTest', function () {
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put success
'
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
);
kvStore
.
sync
(
devices
,
mode
);
}
).
catch
((
error
)
=>
{
}
catch
(
error
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 no peer device :e:
'
+
error
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 no peer device :e:
'
+
error
);
}
)
;
};
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put e
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
...
@@ -914,13 +924,18 @@ describe('DeviceKvStorePromiseTest', function () {
...
@@ -914,13 +924,18 @@ describe('DeviceKvStorePromiseTest', function () {
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 put success
'
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
error
)
=>
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete002 put failed:
'
+
e
);
expect
(
null
).
assertFail
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
);
kvStore
.
sync
(
devices
,
mode
);
}
).
catch
((
error
)
=>
{
}
catch
(
error
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 no peer device :e:
'
+
error
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 no peer device :e:
'
+
error
);
}
)
;
};
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 put e
'
+
e
);
console
.
log
(
'
testDeviceKvStoreOnSyncComplete003 put e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SchemaJsunit.test.js
浏览文件 @
fd1732a7
...
@@ -262,4 +262,25 @@ describe('SchemaTest', function() {
...
@@ -262,4 +262,25 @@ describe('SchemaTest', function() {
}
}
done
();
done
();
})
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_SCHEMA_TOJSONSTRING_0400
* @tc.name [JS-API8]Schema.ToJsonString()
* @tc.desc Test Js Api Schema.ToJsonString() testcase 004
*/
it
(
'
testToJsonString004
'
,
0
,
async
function
(
done
)
{
try
{
let
english
=
new
ddm
.
FieldNode
(
'
english
'
);
english
.
type
=
ddm
.
ValueType
.
STRING
;
let
schema
=
new
ddm
.
Schema
();
schema
.
root
.
appendChild
(
english
);
schema
.
indexes
=
[];
// indexex set to empty array.
console
.
log
(
"
schema:
"
+
schema
.
toJsonString
());
}
catch
(
e
)
{
console
.
log
(
"
schema fail on exception:
"
+
e
);
expect
(
null
).
assertFail
();
}
done
();
})
})
})
\ No newline at end of file
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStoreCallbackJsunit.test.js
浏览文件 @
fd1732a7
...
@@ -821,11 +821,14 @@ describe('SingleKvStoreCallbackTest', function () {
...
@@ -821,11 +821,14 @@ describe('SingleKvStoreCallbackTest', function () {
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
,
function
(
err
,
data
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete101 put success
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete101 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
err
==
undefined
).
assertTrue
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
kvStore
.
sync
(
devices
,
mode
,
10
);
done
();
}
catch
(
e
)
{
});
console
.
log
(
'
testSingleKvStoreOnSyncComplete101 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete101 e
'
+
e
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete101 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -844,19 +847,22 @@ describe('SingleKvStoreCallbackTest', function () {
...
@@ -844,19 +847,22 @@ describe('SingleKvStoreCallbackTest', function () {
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 dataChange
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 dataChange
'
);
expect
(
data
!=
null
).
assertTrue
();
expect
(
data
!=
null
).
assertTrue
();
});
});
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync10
1
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync10
2
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 put success
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
err
==
undefined
).
assertTrue
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
kvStore
.
sync
(
devices
,
mode
,
10
);
done
();
}
catch
(
e
)
{
});
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 e
'
+
e
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete102 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
done
();
}
}
done
();
})
})
/**
/**
...
@@ -870,19 +876,22 @@ describe('SingleKvStoreCallbackTest', function () {
...
@@ -870,19 +876,22 @@ describe('SingleKvStoreCallbackTest', function () {
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 dataChange
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 dataChange
'
);
expect
(
data
!=
null
).
assertTrue
();
expect
(
data
!=
null
).
assertTrue
();
});
});
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync10
1
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
+
'
testSync10
3
'
,
VALUE_TEST_SYNC_ELEMENT
,
function
(
err
,
data
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 put success
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
expect
(
err
==
undefined
).
assertTrue
();
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
,
10
);
kvStore
.
sync
(
devices
,
mode
,
10
);
done
();
}
catch
(
e
)
{
});
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 e
'
+
e
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete103 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
done
();
}
}
done
();
})
})
/**
/**
...
...
distributeddatamgr/distributeddatamgrjstest/hap/src/main/js/default/test/SingleKvStorePromiseJsunit.test.js
浏览文件 @
fd1732a7
...
@@ -830,15 +830,19 @@ describe('SingleKvStorePromiseTest', function () {
...
@@ -830,15 +830,19 @@ describe('SingleKvStorePromiseTest', function () {
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 put success
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 put fail
'
+
error
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 put fail
'
+
error
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
});
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PULL_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete001
put
e
'
+
e
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete001 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
done
();
done
();
...
@@ -858,15 +862,19 @@ describe('SingleKvStorePromiseTest', function () {
...
@@ -858,15 +862,19 @@ describe('SingleKvStorePromiseTest', function () {
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 put success
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 put fail
'
+
error
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 put fail
'
+
error
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
});
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_ONLY
;
kvStore
.
sync
(
devices
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete002
put
e
'
+
e
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete002 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
done
();
done
();
...
@@ -886,15 +894,19 @@ describe('SingleKvStorePromiseTest', function () {
...
@@ -886,15 +894,19 @@ describe('SingleKvStorePromiseTest', function () {
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
await
kvStore
.
put
(
KEY_TEST_SYNC_ELEMENT
,
VALUE_TEST_SYNC_ELEMENT
).
then
((
data
)
=>
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 put success
'
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
expect
(
data
==
undefined
).
assertTrue
();
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
,
10
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 put fail
'
+
error
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 put fail
'
+
error
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
});
});
try
{
var
devices
=
[
'
A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB
'
];
var
mode
=
factory
.
SyncMode
.
PUSH_PULL
;
kvStore
.
sync
(
devices
,
mode
,
10
);
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 sync no peer device :e:
'
+
e
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
testSingleKvStoreOnSyncComplete003
put
e
'
+
e
);
console
.
log
(
'
testSingleKvStoreOnSyncComplete003 e
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
done
();
done
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录