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

!1515 js api8 testcase update.

Merge pull request !1515 from xsterling/master
......@@ -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,25 @@ 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();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PULL_ONLY;
try {
kvStore.sync(devices, mode);
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete101 sync no peer device :e:' + e);
}
done();
expect(data == undefined).assertTrue();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete101 put failed:' + e);
expect(null).assertFail();
});
try {
var mode = factory.SyncMode.PULL_ONLY;
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);
done();
expect(null).assertFail();
}
done();
})
/**
......@@ -880,22 +887,25 @@ 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();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_ONLY;
try {
kvStore.sync(devices, mode);
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete101 sync no peer device :e:' + e);
}
done();
expect(data == undefined).assertTrue();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete102 put failed:' + e);
expect(null).assertFail();
});
try {
var mode = factory.SyncMode.PUSH_ONLY;
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);
done();
expect(null).assertFail();
}
done();
})
/**
......@@ -909,22 +919,25 @@ 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();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_PULL;
try {
kvStore.sync(devices, mode);
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete101 sync no peer device :e:' + e);
}
done();
expect(data == undefined).assertTrue();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete103 put failed:' + e);
expect(null).assertFail();
});
try {
var mode = factory.SyncMode.PUSH_PULL;
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);
done();
expect(null).assertFail();
}
done();
})
/**
......
......@@ -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();
})
......@@ -860,14 +863,19 @@ describe('DeviceKvStorePromiseTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT, VALUE_TEST_SYNC_ELEMENT).then((data) => {
console.log('testDeviceKvStoreOnSyncComplete001 put success');
expect(data == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode);
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete001 no peer device :e:' + error);
console.log('testDeviceKvStoreOnSyncComplete001 put failed:' + e);
expect(null).assertFail();
});
}catch(e) {
console.log('testDeviceKvStoreOnSyncComplete001 put e ' + e);
try {
var mode = factory.SyncMode.PULL_ONLY;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode);
} catch (e) {
console.log('testDeviceKvStoreOnSyncComplete001 sync no peer device :e:' + e);
}
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete001 e ' + e);
expect(null).assertFail();
}
done();
......@@ -887,13 +895,18 @@ describe('DeviceKvStorePromiseTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT, VALUE_TEST_SYNC_ELEMENT).then((data) => {
console.log('testDeviceKvStoreOnSyncComplete002 put success');
expect(data == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_ONLY;
kvStore.sync(devices, mode);
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete002 no peer device :e:' + error);
console.log('testDeviceKvStoreOnSyncComplete002 put failed:' + e);
expect(null).assertFail();
});
}catch(e) {
try {
var mode = factory.SyncMode.PUSH_ONLY;
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();
}
......@@ -914,13 +927,18 @@ describe('DeviceKvStorePromiseTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT, VALUE_TEST_SYNC_ELEMENT).then((data) => {
console.log('testDeviceKvStoreOnSyncComplete003 put success');
expect(data == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_PULL;
kvStore.sync(devices, mode);
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete003 no peer device :e:' + error);
console.log('testDeviceKvStoreOnSyncComplete003 put failed:' + e);
expect(null).assertFail();
});
}catch(e) {
try {
var mode = factory.SyncMode.PUSH_PULL;
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();
}
......
......@@ -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() {
/**
......
......@@ -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();
})
/**
......
......@@ -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();
})
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import factory from '@ohos.data.distributedData'
import factory from '@ohos.data.distributedData';
const TEST_BUNDLE_NAME = 'ohos.acts.distributeddatamgr';
const TEST_STORE_ID = 'storeId';
......@@ -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).assertFalse();
expect(moved == false).assertTrue();
console.log("testKvStoreResultSetMoveToPrevious005 from 0 to " + resultSet.getPosition());
expect(-1).assertEqual(resultSet.getPosition());
} catch (e) {
console.log("testKvStoreResultSetMoveToPrevious005 fail " + e);
expect(null).assertTrue();
expect(null).assertFail();
}
done();
})
......@@ -965,7 +966,7 @@ describe('KvStoreResultSetTest', function() {
expect(moved).assertTrue();
moved = resultSet.moveToNext();
console.log("testKvStoreResultSetIsAfterLast002 moveToNext moved=" + moved);
expect(moved).assertFalse();
expect(moved == false).assertTrue();
var flag = resultSet.isAfterLast();
console.log("testKvStoreResultSetIsAfterLast002 isAfterLast true=" + flag);
expect(flag).assertTrue();
......
......@@ -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();
})
......@@ -262,4 +262,25 @@ describe('SchemaTest', function() {
}
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);
console.log("schema without indexes: " + schema.toJsonString());
schema.indexes = []; // indexex set to empty array -> invalid indexes.
expect(null).assertFail();
} catch (e) {
console.log("schema exception is ok: " + e);
}
done();
})
})
\ No newline at end of file
......@@ -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;
})
/**
......@@ -821,16 +825,19 @@ describe('SingleKvStoreCallbackTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
console.log('testSingleKvStoreOnSyncComplete101 put success');
expect(err == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode, 10);
done();
});
try {
var mode = factory.SyncMode.PULL_ONLY;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode, 10);
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete101 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete101 e' + e);
expect(null).assertFail();
done();
}
done();
})
/**
......@@ -844,19 +851,22 @@ describe('SingleKvStoreCallbackTest', function () {
console.log('testSingleKvStoreOnSyncComplete102 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 + 'testSync102', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
console.log('testSingleKvStoreOnSyncComplete102 put success');
expect(err == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_ONLY;
kvStore.sync(devices, mode, 10);
done();
});
try {
var mode = factory.SyncMode.PUSH_ONLY;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode, 10);
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete102 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete102 e' + e);
expect(null).assertFail();
done();
}
done();
})
/**
......@@ -870,19 +880,22 @@ describe('SingleKvStoreCallbackTest', function () {
console.log('testSingleKvStoreOnSyncComplete103 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 + 'testSync103', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
console.log('testSingleKvStoreOnSyncComplete103 put success');
expect(err == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_PULL;
kvStore.sync(devices, mode, 10);
done();
});
try {
var mode = factory.SyncMode.PUSH_PULL;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode, 10);
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete103 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete103 e' + e);
expect(null).assertFail();
done();
}
done();
})
/**
......
......@@ -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);
}
})
/**
......@@ -72,9 +71,6 @@ describe('KvStoreEnumTest', function () {
* @tc.desc Test Js Enum Value Constants.MAX_KEY_LENGTH_DEVICE
*/
it('testConstantsMaxKeyLengthDevice_001', 0, function () {
expect( factory.Constants.MAX_VALUE_LENGTH).assertEqual(4194303);
var maxKeyLengthDevice = factory.Constants.MAX_KEY_LENGTH_DEVICE;
console.info('maxKeyLengthDevice = ' + maxKeyLengthDevice);
expect(maxKeyLengthDevice == 896).assertTrue()
......
......@@ -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();
})
......@@ -830,15 +833,19 @@ describe('SingleKvStorePromiseTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT, VALUE_TEST_SYNC_ELEMENT).then((data) => {
console.log('testSingleKvStoreOnSyncComplete001 put success');
expect(data == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode, 10);
}).catch((error) => {
console.log('testSingleKvStoreOnSyncComplete001 put fail ' + error);
expect(null).assertFail();
});
try {
var mode = factory.SyncMode.PULL_ONLY;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode, 10);
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete001 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete001 put e ' + e);
console.log('testSingleKvStoreOnSyncComplete001 e ' + e);
expect(null).assertFail();
}
done();
......@@ -858,15 +865,19 @@ describe('SingleKvStorePromiseTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT, VALUE_TEST_SYNC_ELEMENT).then((data) => {
console.log('testSingleKvStoreOnSyncComplete002 put success');
expect(data == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_ONLY;
kvStore.sync(devices, mode, 10);
}).catch((error) => {
console.log('testSingleKvStoreOnSyncComplete002 put fail ' + error);
expect(null).assertFail();
});
try {
var mode = factory.SyncMode.PUSH_ONLY;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode, 10);
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete002 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete002 put e ' + e);
console.log('testSingleKvStoreOnSyncComplete002 e ' + e);
expect(null).assertFail();
}
done();
......@@ -886,15 +897,19 @@ describe('SingleKvStorePromiseTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT, VALUE_TEST_SYNC_ELEMENT).then((data) => {
console.log('testSingleKvStoreOnSyncComplete003 put success');
expect(data == undefined).assertTrue();
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_PULL;
kvStore.sync(devices, mode, 10);
}).catch((error) => {
console.log('testSingleKvStoreOnSyncComplete003 put fail ' + error);
expect(null).assertFail();
});
try {
var mode = factory.SyncMode.PUSH_PULL;
console.log('kvStore.sync to ' + JSON.stringify(syncDeviceIds));
kvStore.sync(syncDeviceIds, mode, 10);
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete003 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete003 put e ' + e);
console.log('testSingleKvStoreOnSyncComplete003 e ' + e);
expect(null).assertFail();
}
done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册