提交 5294f464 编写于 作者: Z zeng_xingdong

add running log for failure, fix code checking, remove all unness return

Signed-off-by: Nzeng_xingdong <zengxingdong@huawei.com>
上级 6ae092cf
...@@ -28,10 +28,11 @@ describe('deviceManagerTest', function() { ...@@ -28,10 +28,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_createDeviceManager_0100----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
expect(data).assertUndefined(); expect(data != null).assertTrue()
}); })
console.log("----------stop running deviceManagerTest_createDeviceManager_0100----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0100----------");
done(); done();
}) })
...@@ -46,9 +47,10 @@ describe('deviceManagerTest', function() { ...@@ -46,9 +47,10 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_createDeviceManager_0200----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0200----------");
deviceManager.createDeviceManager('', (err, data) => { deviceManager.createDeviceManager('', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull(); expect(data == null).assertTrue()
}); });
console.log("----------stop running deviceManagerTest_createDeviceManager_0200----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0200----------");
done(); done();
...@@ -64,9 +66,10 @@ describe('deviceManagerTest', function() { ...@@ -64,9 +66,10 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_createDeviceManager_0300----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0300----------");
deviceManager.createDeviceManager('comohosdevicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('comohosdevicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull(); expect(data == null).assertTrue()
}); });
console.log("----------stop running deviceManagerTest_createDeviceManager_0300----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0300----------");
done(); done();
...@@ -82,9 +85,10 @@ describe('deviceManagerTest', function() { ...@@ -82,9 +85,10 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_createDeviceManager_0400----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0400----------");
deviceManager.createDeviceManager('com.ohos.123', (err, data) => { deviceManager.createDeviceManager('com.ohos.123', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull(); expect(data == null).assertTrue()
}); });
console.log("----------stop running deviceManagerTest_createDeviceManager_0400----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0400----------");
done(); done();
...@@ -100,9 +104,10 @@ describe('deviceManagerTest', function() { ...@@ -100,9 +104,10 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_createDeviceManager_0500----------"); console.log("----------start running deviceManagerTest_createDeviceManager_0500----------");
deviceManager.createDeviceManager('com#ohos%devicemangagerdemo&*', (err, data) => { deviceManager.createDeviceManager('com#ohos%devicemangagerdemo&*', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
expect(data).assertNull(); expect(data == null).assertTrue()
}); });
console.log("----------stop running deviceManagerTest_createDeviceManager_0500----------"); console.log("----------stop running deviceManagerTest_createDeviceManager_0500----------");
done(); done();
...@@ -118,6 +123,7 @@ describe('deviceManagerTest', function() { ...@@ -118,6 +123,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
...@@ -131,7 +137,7 @@ describe('deviceManagerTest', function() { ...@@ -131,7 +137,7 @@ describe('deviceManagerTest', function() {
"capability": 0 "capability": 0
}; };
var start = data.startDeviceDiscovery(info); var start = data.startDeviceDiscovery(info);
expect(start).assertUndefined(); expect(start != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------");
done(); done();
...@@ -147,6 +153,7 @@ describe('deviceManagerTest', function() { ...@@ -147,6 +153,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
...@@ -160,7 +167,7 @@ describe('deviceManagerTest', function() { ...@@ -160,7 +167,7 @@ describe('deviceManagerTest', function() {
"capability": SUBSCRIBE_CAPABILITY_OSD "capability": SUBSCRIBE_CAPABILITY_OSD
}; };
var start = data.startDeviceDiscovery(info); var start = data.startDeviceDiscovery(info);
expect(start).assertUndefined(); expect(start != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------");
done(); done();
...@@ -176,6 +183,7 @@ describe('deviceManagerTest', function() { ...@@ -176,6 +183,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------start running deviceManagerTest_startDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
...@@ -189,7 +197,7 @@ describe('deviceManagerTest', function() { ...@@ -189,7 +197,7 @@ describe('deviceManagerTest', function() {
"capability": SUBSCRIBE_CAPABILITY_DDMP "capability": SUBSCRIBE_CAPABILITY_DDMP
}; };
var start = data.startDeviceDiscovery(info); var start = data.startDeviceDiscovery(info);
expect(start).assertUndefined(); expect(start != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------"); console.log("----------stop running deviceManagerTest_startDeviceDiscovery_0100----------");
done(); done();
...@@ -205,10 +213,11 @@ describe('deviceManagerTest', function() { ...@@ -205,10 +213,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_release_0100----------"); console.log("----------start running deviceManagerTest_release_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var re = data.release(); var re = data.release();
expect(re).assertUndefined(); expect(re != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_release_0100----------"); console.log("----------stop running deviceManagerTest_release_0100----------");
done(); done();
...@@ -224,10 +233,11 @@ describe('deviceManagerTest', function() { ...@@ -224,10 +233,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_getTrustedDeviceListSync_0100----------"); console.log("----------start running deviceManagerTest_getTrustedDeviceListSync_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var array = data.getTrustedDeviceListSync(); var array = data.getTrustedDeviceListSync();
expect(array).assertUndefined(); expect(array == null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_getTrustedDeviceListSync_0100----------"); console.log("----------stop running deviceManagerTest_getTrustedDeviceListSync_0100----------");
done(); done();
...@@ -243,11 +253,12 @@ describe('deviceManagerTest', function() { ...@@ -243,11 +253,12 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0100----------"); console.log("----------start running deviceManagerTest_stopDeviceDiscovery_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var subscribeId = 2115; var subscribeId = 2115;
var start = data.stopDeviceDiscovery(subscribeId); var start = data.stopDeviceDiscovery(subscribeId);
expect(start).assertUndefined(); expect(start != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0100----------"); console.log("----------stop running deviceManagerTest_stopDeviceDiscovery_0100----------");
done(); done();
...@@ -263,6 +274,7 @@ describe('deviceManagerTest', function() { ...@@ -263,6 +274,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_getLocalDeviceInfoSync_0100----------"); console.log("----------start running deviceManagerTest_getLocalDeviceInfoSync_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
...@@ -288,6 +300,7 @@ describe('deviceManagerTest', function() { ...@@ -288,6 +300,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100----------"); console.log("----------start running deviceManagerTest_deviceManagerTest_getLocalDeviceInfo1_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
...@@ -299,6 +312,7 @@ describe('deviceManagerTest', function() { ...@@ -299,6 +312,7 @@ describe('deviceManagerTest', function() {
var deviceInfo = dmClass.getLocalDeviceInfo((err, data) => { var deviceInfo = dmClass.getLocalDeviceInfo((err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
console.log("[deviceManagerTest] createDeviceManager error");
} }
}); });
expect(deviceInfo == undefined).assertTrue(); expect(deviceInfo == undefined).assertTrue();
...@@ -317,6 +331,7 @@ describe('deviceManagerTest', function() { ...@@ -317,6 +331,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------"); console.log("----------start running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
...@@ -326,9 +341,7 @@ describe('deviceManagerTest', function() { ...@@ -326,9 +341,7 @@ describe('deviceManagerTest', function() {
}); });
async function getLocalDeviceInfo2(){ async function getLocalDeviceInfo2(){
var deviceInfo = dmClass.getLocalDeviceInfo().then(data => { var deviceInfo = dmClass.getLocalDeviceInfo().then(data => {
// console.log('data is :' + data)
}) })
// console.log('promise is : ' + JSON.stringify(deviceInfo))
expect(deviceInfo != null).assertTrue(); expect(deviceInfo != null).assertTrue();
} }
console.log("----------stop running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------"); console.log("----------stop running deviceManagerTest_getLocalDeviceInfo(promise)_0100----------");
...@@ -345,6 +358,7 @@ describe('deviceManagerTest', function() { ...@@ -345,6 +358,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let deviceInfo = { let deviceInfo = {
...@@ -368,9 +382,10 @@ describe('deviceManagerTest', function() { ...@@ -368,9 +382,10 @@ describe('deviceManagerTest', function() {
data.authenticateDevice(deviceInfo, authParam, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
console.log("[deviceManagerTest] createDeviceManager error");
} }
var token = data.pinToken; var token = data.pinToken;
expect(token).assertNotNull(); expect(token != null).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -387,6 +402,7 @@ describe('deviceManagerTest', function() { ...@@ -387,6 +402,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let deviceInfo = { let deviceInfo = {
...@@ -409,10 +425,11 @@ describe('deviceManagerTest', function() { ...@@ -409,10 +425,11 @@ describe('deviceManagerTest', function() {
} }
data.authenticateDevice(deviceInfo, authParam, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] authenticateDevice error");
expect().assertFail(); expect().assertFail();
} }
var token = data.pinToken; var token = data.pinToken;
expect(token).assertNotNull(); expect(token != null).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -429,6 +446,7 @@ describe('deviceManagerTest', function() { ...@@ -429,6 +446,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let deviceInfo = { let deviceInfo = {
...@@ -451,10 +469,11 @@ describe('deviceManagerTest', function() { ...@@ -451,10 +469,11 @@ describe('deviceManagerTest', function() {
} }
data.authenticateDevice(deviceInfo, authParam, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] authenticateDevice error");
expect().assertFail(); expect().assertFail();
} }
var token = data.pinToken; var token = data.pinToken;
expect(token).assertNotNull(); expect(token != null).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -471,6 +490,7 @@ describe('deviceManagerTest', function() { ...@@ -471,6 +490,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let deviceInfo = { let deviceInfo = {
...@@ -493,10 +513,11 @@ describe('deviceManagerTest', function() { ...@@ -493,10 +513,11 @@ describe('deviceManagerTest', function() {
} }
data.authenticateDevice(deviceInfo, authParam, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] authenticateDevice error");
expect().assertFail(); expect().assertFail();
} }
var token = data.pinToken; var token = data.pinToken;
expect(token).assertNotNull(); expect(token != null).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -513,6 +534,7 @@ describe('deviceManagerTest', function() { ...@@ -513,6 +534,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let deviceInfo = { let deviceInfo = {
...@@ -535,10 +557,11 @@ describe('deviceManagerTest', function() { ...@@ -535,10 +557,11 @@ describe('deviceManagerTest', function() {
} }
data.authenticateDevice(deviceInfo, authParam, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] authenticateDevice error");
expect().assertFail(); expect().assertFail();
} }
var token = data.pinToken; var token = data.pinToken;
expect(token).assertNotNull(); expect(token != null).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -555,6 +578,7 @@ describe('deviceManagerTest', function() { ...@@ -555,6 +578,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let deviceInfo = { let deviceInfo = {
...@@ -577,10 +601,11 @@ describe('deviceManagerTest', function() { ...@@ -577,10 +601,11 @@ describe('deviceManagerTest', function() {
} }
data.authenticateDevice(deviceInfo, authParam, (err, data) => { data.authenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] authenticateDevice error");
expect().assertFail(); expect().assertFail();
} }
var token = data.pinToken; var token = data.pinToken;
expect(token).assertNotNull(); expect(token != null).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -597,6 +622,7 @@ describe('deviceManagerTest', function() { ...@@ -597,6 +622,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_authenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
let authInfo = { let authInfo = {
...@@ -610,7 +636,7 @@ describe('deviceManagerTest', function() { ...@@ -610,7 +636,7 @@ describe('deviceManagerTest', function() {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
} }
expect(data).assertUndefined(); expect(data == undefined).assertTrue();
}); });
}); });
console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------"); console.log("----------stop running deviceManagerTest_authenticateDevice_0100----------");
...@@ -627,6 +653,7 @@ describe('deviceManagerTest', function() { ...@@ -627,6 +653,7 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_unAuthenticateDevice_0100----------"); console.log("----------start running deviceManagerTest_unAuthenticateDevice_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
setTimeout(function(){ setTimeout(function(){
...@@ -655,6 +682,7 @@ describe('deviceManagerTest', function() { ...@@ -655,6 +682,7 @@ describe('deviceManagerTest', function() {
} }
var result = dmClass.unAuthenticateDevice(deviceInfo, authParam, (err, data) => { var result = dmClass.unAuthenticateDevice(deviceInfo, authParam, (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] unAuthenticateDevice error");
expect().assertFail(); expect().assertFail();
} }
}); });
...@@ -674,10 +702,11 @@ describe('deviceManagerTest', function() { ...@@ -674,10 +702,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_getAuthenticationParam_0100----------"); console.log("----------start running deviceManagerTest_getAuthenticationParam_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var authparam = data.getAuthenticationParam(); var authparam = data.getAuthenticationParam();
expect(authparam).assertNotNull(); expect(authparam != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_getAuthenticationParam_0100----------"); console.log("----------stop running deviceManagerTest_getAuthenticationParam_0100----------");
done(); done();
...@@ -693,12 +722,13 @@ describe('deviceManagerTest', function() { ...@@ -693,12 +722,13 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => { var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
expect(true).assertEqual(deviceStateChangeAction.ONLINE == 0); expect(deviceStateChangeAction.ONLINE == 0).assertTrue();
}); });
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
done(); done();
...@@ -714,12 +744,13 @@ describe('deviceManagerTest', function() { ...@@ -714,12 +744,13 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => { var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
expect(true).assertEqual(deviceStateChangeAction.OFFLINE == 0); expect(deviceStateChangeAction.OFFLINE == 0).assertTrue();
}); });
expect(fa).assertUndefined(); expect(fa != null).assertNotNull();
}); });
console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
done(); done();
...@@ -735,12 +766,13 @@ describe('deviceManagerTest', function() { ...@@ -735,12 +766,13 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => { var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
expect(true).assertEqual(deviceStateChangeAction.READY == 0); expect(deviceStateChangeAction.READY == 0).assertTrue();
}); });
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
done(); done();
...@@ -756,12 +788,13 @@ describe('deviceManagerTest', function() { ...@@ -756,12 +788,13 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_on-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => { var fa = data.on('deviceStateChange', (deviceStateChangeAction, deviceInfo) => {
expect(true).assertEqual(deviceStateChangeAction.CHANGE == 0); expect(deviceStateChangeAction.CHANGE == 0).assertTrue();
}); });
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceStateChange_0100----------");
done(); done();
...@@ -777,10 +810,11 @@ describe('deviceManagerTest', function() { ...@@ -777,10 +810,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_off-deviceStateChange_0100----------"); console.log("----------start running deviceManagerTest_off-deviceStateChange_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.off('deviceStateChange', () => {}); var fa = data.off('deviceStateChange', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_off-deviceStateChange_0100----------"); console.log("----------stop running deviceManagerTest_off-deviceStateChange_0100----------");
done(); done();
...@@ -796,10 +830,11 @@ describe('deviceManagerTest', function() { ...@@ -796,10 +830,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-deviceFound_0100----------"); console.log("----------start running deviceManagerTest_on-deviceFound_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('deviceFound', () => {}); var fa = data.on('deviceFound', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_on-deviceFound_0100----------"); console.log("----------stop running deviceManagerTest_on-deviceFound_0100----------");
done(); done();
...@@ -815,10 +850,11 @@ describe('deviceManagerTest', function() { ...@@ -815,10 +850,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_off-deviceFound_0100----------"); console.log("----------start running deviceManagerTest_off-deviceFound_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.off('deviceFound', () => {}); var fa = data.off('deviceFound', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_off-deviceFound_0100----------"); console.log("----------stop running deviceManagerTest_off-deviceFound_0100----------");
done(); done();
...@@ -834,10 +870,11 @@ describe('deviceManagerTest', function() { ...@@ -834,10 +870,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-discoverFail_0100----------"); console.log("----------start running deviceManagerTest_on-discoverFail_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('discoverFail', () => {}); var fa = data.on('discoverFail', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_on-discoverFail_0100----------"); console.log("----------stop running deviceManagerTest_on-discoverFail_0100----------");
done(); done();
...@@ -853,10 +890,11 @@ describe('deviceManagerTest', function() { ...@@ -853,10 +890,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_off-discoverFail_0100----------"); console.log("----------start running deviceManagerTest_off-discoverFail_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.off('discoverFail', () => {}); var fa = data.off('discoverFail', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_off-discoverFail_0100----------"); console.log("----------stop running deviceManagerTest_off-discoverFail_0100----------");
done(); done();
...@@ -872,10 +910,11 @@ describe('deviceManagerTest', function() { ...@@ -872,10 +910,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_on-serviceDie_0100----------"); console.log("----------start running deviceManagerTest_on-serviceDie_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.on('serviceDie', () => {}); var fa = data.on('serviceDie', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------start running deviceManagerTest_on-serviceDie_0100----------"); console.log("----------start running deviceManagerTest_on-serviceDie_0100----------");
done(); done();
...@@ -891,10 +930,11 @@ describe('deviceManagerTest', function() { ...@@ -891,10 +930,11 @@ describe('deviceManagerTest', function() {
console.log("----------start running deviceManagerTest_off-serviceDie_0100----------"); console.log("----------start running deviceManagerTest_off-serviceDie_0100----------");
deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => { deviceManager.createDeviceManager('com.ohos.devicemangagerdemo', (err, data) => {
if (err) { if (err) {
console.log("[deviceManagerTest] createDeviceManager error");
expect().assertFail(); expect().assertFail();
} }
var fa = data.off('serviceDie', () => {}); var fa = data.off('serviceDie', () => {});
expect(fa).assertUndefined(); expect(fa != null).assertTrue();
}); });
console.log("----------stop running deviceManagerTest_off-serviceDie_0100----------"); console.log("----------stop running deviceManagerTest_off-serviceDie_0100----------");
done(); done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册