未验证 提交 ce026884 编写于 作者: O openharmony_ci 提交者: Gitee

!8485 add assertion

Merge pull request !8485 from yanglifeng/OpenHarmony-3.2-Release
...@@ -79,8 +79,13 @@ describe('kvManagerCallbackTest', function () { ...@@ -79,8 +79,13 @@ describe('kvManagerCallbackTest', function () {
console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0100'); console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0100');
try { try {
await kvManager.getKVStore(TEST_STORE_ID, options, function (err, store) { await kvManager.getKVStore(TEST_STORE_ID, options, function (err, store) {
expect((err == undefined) && (store != null)).assertTrue();
console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0100 getKVStore success'); console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0100 getKVStore success');
kvStore = store; kvStore = store;
kvStore.getSecurityLevel().then((data) => {
console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0100 securityLevel = ' + data);
expect((data == factory.SecurityLevel.S2)).assertTrue();
});
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -104,7 +109,8 @@ describe('kvManagerCallbackTest', function () { ...@@ -104,7 +109,8 @@ describe('kvManagerCallbackTest', function () {
console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0200 getKVStore success'); console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0200 getKVStore success');
expect(null).assertFail(); expect(null).assertFail();
} else { } else {
console.info('SUB_DDM_DKV_KVMANAGER_GETKVSTORE_0200 getKVStore fail'); expect((err.code == 401)).assertTrue();
console.info('getKVStore fail' + `, error code is ${err.code}, message is ${err.message}`);
} }
done(); done();
}); });
......
...@@ -82,8 +82,13 @@ describe('kvManagerCallbackTest', function () { ...@@ -82,8 +82,13 @@ describe('kvManagerCallbackTest', function () {
console.info('testKVManagerGetKVStore101'); console.info('testKVManagerGetKVStore101');
try { try {
await kvManager.getKVStore(TEST_STORE_ID, options, function (err, store) { await kvManager.getKVStore(TEST_STORE_ID, options, function (err, store) {
expect((err == undefined) && (store != null)).assertTrue();
console.info('testKVManagerGetKVStore101 getKVStore success'); console.info('testKVManagerGetKVStore101 getKVStore success');
kvStore = store; kvStore = store;
kvStore.getSecurityLevel().then((data) => {
console.info('testKVManagerGetKVStore101 securityLevel = ' + data);
expect((data == factory.SecurityLevel.S2)).assertTrue();
});
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -106,6 +111,7 @@ describe('kvManagerCallbackTest', function () { ...@@ -106,6 +111,7 @@ describe('kvManagerCallbackTest', function () {
console.info('testKVManagerGetKVStore102 getKVStore success'); console.info('testKVManagerGetKVStore102 getKVStore success');
expect(null).assertFail(); expect(null).assertFail();
} else { } else {
expect((err != undefined)).assertTrue();
console.info('testKVManagerGetKVStore102 getKVStore fail'); console.info('testKVManagerGetKVStore102 getKVStore fail');
} }
done(); done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册