提交 b7a1544c 编写于 作者: 1 15829070344 提交者: 何海涛

fixed cd6f0b34 from https://gitee.com/murphy1984/acts/pulls/6389

【时间时区】XTS偶发失败优化
Signed-off-by: N15829070344 <hehaitao5@huawei.com>
Change-Id: Ia8d12ce7387262b09cae972d7c492180ede9a050
上级 e82f126b
......@@ -32,16 +32,15 @@ export default function systemTimeJsunit() {
console.info("====>----------UB_systemTime_getCurrentTime_JS_API_0001 start----------------");
systemTime.getCurrentTime(true, (error, data) => {
if (error) {
console.error(`failed to systemTime.getCurrentTime because ` + JSON.stringify(error));
console.error('failed to systemTime.getCurrentTime because ' + JSON.stringify(error));
expect().assertFail();
};
console.info(`systemTime.getCurrentTime success data : ` + JSON.stringify(data));
console.info('====>SystemTime.getCurrentTime success data : ' + JSON.stringify(data));
expect(data != null).assertEqual(true);
});
console.info("====>----------SUB_systemTime_getRealActiveTime_JS_API_0100 end-----------------");
done();
});
});
/**
* @tc.number SUB_systemTime_getCurrentTime_JS_API_0002
......@@ -54,15 +53,16 @@ export default function systemTimeJsunit() {
it("SUB_systemTime_getCurrentTime_JS_API_0002", 0, async function (done) {
console.info("====>-----SUB_systemTime_getCurrentTime_JS_API_0002 start----------------");
systemTime.getCurrentTime(true).then((data) => {
console.info(`SUB_systemTime_getCurrentTime_JS_API_0002 data : ` + JSON.stringify(data));
console.info('====>SUB_systemTime_getCurrentTime_JS_API_0002 data : ' + JSON.stringify(data));
expect(data != null).assertEqual(true);
console.info("====>-----SUB_systemTime_getCurrentTime_JS_API_0002 end------------");
done();
}).catch(err => {
console.error(`SUB_systemTime_getCurrentTime_JS_API_0002 err: ` + JSON.stringify(error));
console.error('SUB_systemTime_getCurrentTime_JS_API_0002 err: ' + JSON.stringify(error));
expect().assertFail()
});
console.info("====>-----SUB_systemTime_getCurrentTime_JS_API_0002 end------------");
done();
});
});
/**
* @tc.number SUB_systemTime_getRealActiveTime_JS_API_0001
......@@ -76,16 +76,15 @@ export default function systemTimeJsunit() {
console.info("====>----------SUB_systemTime_getRealActiveTime_JS_API_0001 start----------------");
systemTime.getRealActiveTime(true, (error, data) => {
if (error) {
console.error(`SUB_systemTime_getRealActiveTime_JS_API_0001 err: ` + JSON.stringify(error));
console.error('SUB_systemTime_getRealActiveTime_JS_API_0001 err: ' + JSON.stringify(error));
expect().assertFail()
};
console.info(`SUB_systemTime_getRealActiveTime_JS_API_0001 data : ` + JSON.stringify(data));
console.info('====>SUB_systemTime_getRealActiveTime_JS_API_0001 data : ' + JSON.stringify(data));
expect(data != null).assertEqual(true);
});
console.info("====>----------SUB_systemTime_getRealActiveTime_JS_API_0001 end-----------------");
done();
});
});
/**
* @tc.number SUB_systemTime_getRealActiveTime_JS_API_0002
......@@ -98,15 +97,16 @@ export default function systemTimeJsunit() {
it("SUB_systemTime_getRealActiveTime_JS_API_0002", 0, async function (done) {
console.info("====>-----SUB_systemTime_getRealActiveTime_JS_API_0002 start----------------");
systemTime.getRealActiveTime(true).then((data) => {
onsole.log(`SUB_systemTime_getRealActiveTime_JS_API_0002 data : ` + JSON.stringify(data));
console.log('SUB_systemTime_getRealActiveTime_JS_API_0002 data : ' + JSON.stringify(data));
expect(data != null).assertEqual(true);
console.info("====>-----SUB_systemTime_getRealActiveTime_JS_API_0002 end------------");
done();
}).catch(err => {
console.error(`SUB_systemTime_getRealActiveTime_JS_API_0002 err: ` + JSON.stringify(error));
console.error('SUB_systemTime_getRealActiveTime_JS_API_0002 err: ' + JSON.stringify(error));
expect().assertFail()
});
console.info("====>-----SUB_systemTime_getRealActiveTime_JS_API_0002 end------------");
done();
});
});
/**
* @tc.number SUB_systemTime_getRealTime_JS_API_0001
......@@ -120,17 +120,17 @@ export default function systemTimeJsunit() {
console.info("====>----------SUB_systemTime_getRealTime_JS_API_0001 start----------------");
systemTime.getRealTime(true, (error, data) => {
if (error) {
console.error(`SUB_systemTime_getRealTime_JS_API_0001 err: ` + JSON.stringify(error));
console.error('SUB_systemTime_getRealTime_JS_API_0001 err: ' + JSON.stringify(error));
expect().assertFail()
};
console.info(`SUB_systemTime_getRealTime_JS_API_0001 data : ` + JSON.stringify(data));
console.info('====>SUB_systemTime_getRealTime_JS_API_0001 data : ' + JSON.stringify(data));
expect(data != null).assertEqual(true);
});
console.info("====>----------SUB_systemTime_getRealTime_JS_API_0001 end-----------------");
done();
});
});
/**
* @tc.number SUB_systemTime_getRealTime_JS_API_0002
* @tc.name Test systemTime.getCurrentTime
......@@ -142,10 +142,10 @@ export default function systemTimeJsunit() {
it("SUB_systemTime_getRealTime_JS_API_0002", 0, async function (done) {
console.info("====>-----SUB_systemTime_getRealTime_JS_API_0002 start----------------");
systemTime.getRealTime(true).then((data) => {
console.info(`SUB_systemTime_getRealTime_JS_API_0002 data : ` + JSON.stringify(data));
console.info('====>SUB_systemTime_getRealTime_JS_API_0002 data : ' + JSON.stringify(data));
expect(data != null).assertEqual(true);
}).catch(err => {
console.error(`SUB_systemTime_getRealTime_JS_API_0002 err: ` + JSON.stringify(error));
console.error('SUB_systemTime_getRealTime_JS_API_0002 err: ' + JSON.stringify(error));
expect().assertFail();
});
console.info("====>-----SUB_systemTime_getRealTime_JS_API_0002 end------------");
......@@ -186,17 +186,17 @@ export default function systemTimeJsunit() {
console.info("====>SUB_systemTime_setTime_JS_API_0200 start");
try{
systemTime.setTime(15222).then(() => {
console.debug('SUB_systemTime_setTime_JS_API_0200 setTime fail')
console.debug('====>SUB_systemTime_setTime_JS_API_0200 setTime fail')
expect().assertFail();
done();
}).catch((err)=>{
console.debug('SUB_systemTime_setTime_JS_API_0200 setTime err:' + JSON.stringify(err))
console.debug('====>SUB_systemTime_setTime_JS_API_0200 setTime err:' + JSON.stringify(err))
expect(true).assertTrue();
console.debug('SUB_systemTime_setTime_JS_API_0200 end');
console.debug('====>SUB_systemTime_setTime_JS_API_0200 end');
done();
})
}catch(err){
console.debug('SUB_systemTime_setTime_JS_API_0200 setTime throw_err' + JSON.stringify(err))
console.debug('====>SUB_systemTime_setTime_JS_API_0200 setTime throw_err' + JSON.stringify(err))
expect(err.code).assertEqual('401');
done();
}
......@@ -216,7 +216,7 @@ export default function systemTimeJsunit() {
systemTime.setTime(currentTime, (err) => {
try{
expect(true).assertTrue();
console.info('SUB_systemTime_setTime_JS_API_0300 end');
console.info('====>SUB_systemTime_setTime_JS_API_0300 end');
done();
}catch(err){
console.info("====>SUB_systemTime_setTime_JS_API_0300 error: " + err);
......@@ -241,12 +241,13 @@ export default function systemTimeJsunit() {
console.info("====>SUB_systemTime_setTime_JS_API_0400 data: " + data);
console.info("====>SUB_systemTime_setTime_JS_API_0400 error: " + err);
expect(true).assertTrue();
})}catch(error) {error => {
expect(1).assertLarger(0);
};
};
console.info('SUB_systemTime_setTime_JS_API_0400 end');
console.info('====>SUB_systemTime_setTime_JS_API_0400 end');
done();
})
}catch(err) {
expect().assertFail();
done();
};
});
/**
......@@ -262,13 +263,14 @@ export default function systemTimeJsunit() {
var data = new Date("October 13, 2020 11:13:00");
systemTime.setDate(1).then(data => {
console.info("====>SUB_systemTime_setDate_JS_API_0100 data " + data);
expect(true).assertTrue();
expect().assertFail();
done();
}).catch(error => {
console.info("====>SUB_systemTime_setDate_JS_API_0100 error " + error);
expect().assertFail();
});
expect(true).assertTrue();
done();
});
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0200
......@@ -282,13 +284,14 @@ export default function systemTimeJsunit() {
console.info("====>SUB_systemTime_setDate_JS_API_0200 start");
systemTime.setDate(0).then(data => {
console.info("====>SUB_systemTime_setDate_JS_API_0200 data " + data);
expect(true).assertTrue();
expect().assertFail();
done();
}).catch(error => {
console.info("====>SUB_systemTime_setDate_JS_API_0200 error " + error);
expect().assertFail();
});
expect(true).assertTrue();
done();
});
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0300
......@@ -304,13 +307,14 @@ export default function systemTimeJsunit() {
systemTime.setDate(data, (error, data) => {
if(error){
console.info("====>SUB_systemTime_setDate_JS_API_0300 error " + error);
expect().assertFail();
expect(true).assertTrue();
done();
}else{
console.info("====>SUB_systemTime_setDate_JS_API_0300 data " + data);
expect(true).assertTrue();
expect().assertFail();
done();
};
});
done();
});
/**
......@@ -329,9 +333,9 @@ export default function systemTimeJsunit() {
}).catch(error => {
console.info("====>SUB_systemTime_setTimezone_JS_API_0100 error " + error);
expect(true).assertTrue();
});
done();
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0200
......@@ -349,9 +353,9 @@ export default function systemTimeJsunit() {
}).catch(error => {
console.info("====>SUB_systemTime_setTimezone_JS_API_0200 error " + error);
expect(true).assertTrue();
});
done();
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0300
......@@ -369,8 +373,8 @@ export default function systemTimeJsunit() {
}).catch(error => {
console.info("====>SUB_systemTime_setTimezone_JS_API_0300 error " + error);
expect(true).assertTrue();
});
done();
});
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册