提交 fd1732a7 编写于 作者: X xsterling

testcase update.

Signed-off-by: Nxsterling <huangjiaqi19@huawei.com>
上级 24459f98
......@@ -854,19 +854,21 @@ describe('DeviceKvStoreCallbackTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
console.log('testDeviceKvStoreOnSyncComplete101 put success');
expect(err == undefined).assertTrue();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete101 put failed:' + e);
expect(null).assertFail();
});
try {
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();
});
}catch(e) {
console.log('testDeviceKvStoreOnSyncComplete101 no peer device :e:' + e);
done();
}
done();
})
/**
......@@ -883,19 +885,21 @@ describe('DeviceKvStoreCallbackTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
console.log('testDeviceKvStoreOnSyncComplete102 put success');
expect(err == undefined).assertTrue();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete102 put failed:' + e);
expect(null).assertFail();
});
try {
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);
console.log('testDeviceKvStoreOnSyncComplete102 sync no peer device :e:' + e);
}
done();
});
}catch(e) {
console.log('testDeviceKvStoreOnSyncComplete102 no peer device :e:' + e);
done();
}
done();
})
/**
......@@ -912,19 +916,21 @@ describe('DeviceKvStoreCallbackTest', function () {
await kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
console.log('testDeviceKvStoreOnSyncComplete103 put success');
expect(err == undefined).assertTrue();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete103 put failed:' + e);
expect(null).assertFail();
});
try {
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);
console.log('testDeviceKvStoreOnSyncComplete103 sync no peer device :e:' + e);
}
done();
});
}catch(e) {
console.log('testDeviceKvStoreOnSyncComplete103 no peer device :e:' + e);
done();
}
done();
})
/**
......
......@@ -860,14 +860,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();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete001 put failed:' + e);
expect(null).assertFail();
});
try {
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode);
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete001 no peer device :e:' + error);
});
}catch(e) {
console.log('testDeviceKvStoreOnSyncComplete001 put e ' + e);
} catch (e) {
console.log('testDeviceKvStoreOnSyncComplete001 sync no peer device :e:' + e);
}
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete001 e ' + e);
expect(null).assertFail();
}
done();
......@@ -887,13 +892,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();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete002 put failed:' + e);
expect(null).assertFail();
});
try {
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_ONLY;
kvStore.sync(devices, mode);
}).catch((error) => {
} catch(error) {
console.log('testDeviceKvStoreOnSyncComplete002 no peer device :e:' + error);
});
}catch(e) {
};
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete002 put e ' + e);
expect(null).assertFail();
}
......@@ -914,13 +924,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();
}).catch((error) => {
console.log('testDeviceKvStoreOnSyncComplete002 put failed:' + e);
expect(null).assertFail();
});
try {
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_PULL;
kvStore.sync(devices, mode);
}).catch((error) => {
} catch(error) {
console.log('testDeviceKvStoreOnSyncComplete003 no peer device :e:' + error);
});
}catch(e) {
};
} catch(e) {
console.log('testDeviceKvStoreOnSyncComplete003 put e ' + e);
expect(null).assertFail();
}
......
......@@ -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);
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
......@@ -821,11 +821,14 @@ 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();
});
try {
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode, 10);
done();
});
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete101 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete101 e' + e);
expect(null).assertFail();
......@@ -844,19 +847,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();
});
try {
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_ONLY;
kvStore.sync(devices, mode, 10);
done();
});
} 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 +876,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();
});
try {
var devices = ['A12C1F9261528B21F95778D2FDC0B2E33943E6251AC5487F4473D005758905DB'];
var mode = factory.SyncMode.PUSH_PULL;
kvStore.sync(devices, mode, 10);
done();
});
} catch (e) {
console.log('testSingleKvStoreOnSyncComplete103 sync no peer device :e:' + e);
}
}catch(e) {
console.log('testSingleKvStoreOnSyncComplete103 e' + e);
expect(null).assertFail();
done();
}
done();
})
/**
......
......@@ -830,15 +830,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 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) {
console.log('testSingleKvStoreOnSyncComplete001 put e ' + e);
console.log('testSingleKvStoreOnSyncComplete001 e ' + e);
expect(null).assertFail();
}
done();
......@@ -858,15 +862,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 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) {
console.log('testSingleKvStoreOnSyncComplete002 put e ' + e);
console.log('testSingleKvStoreOnSyncComplete002 e ' + e);
expect(null).assertFail();
}
done();
......@@ -886,15 +894,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 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) {
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.
先完成此消息的编辑!
想要评论请 注册