提交 97564d39 编写于 作者: O openharmony_ci 提交者: Gitee

!1404 Fix ans test failed case

Merge pull request !1404 from blackleon/master_ans_1221
...@@ -50,8 +50,8 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -50,8 +50,8 @@ describe('ActsAnsDoNotDisturbTest', function () {
await notify.getDoNotDisturbDate((err,data) => { await notify.getDoNotDisturbDate((err,data) => {
console.log("===>ActsGetDoNotDisturbTest_test_0100 success===>"+JSON.stringify(data)) console.log("===>ActsGetDoNotDisturbTest_test_0100 success===>"+JSON.stringify(data))
expect(data.type).assertEqual(0); expect(data.type).assertEqual(0);
expect(data.begin).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
expect(data.end).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
done(); done();
}) })
}) })
...@@ -65,8 +65,8 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -65,8 +65,8 @@ describe('ActsAnsDoNotDisturbTest', function () {
notify.getDoNotDisturbDate().then((promise)=>{ notify.getDoNotDisturbDate().then((promise)=>{
console.log("===>test_0200 success===>"+JSON.stringify(promise)) console.log("===>test_0200 success===>"+JSON.stringify(promise))
expect(promise.type).assertEqual(0); expect(promise.type).assertEqual(0);
expect(promise.begin).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(promise.begin.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
expect(promise.end).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(promise.end.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
done()} done()}
).catch((err)=>{ ).catch((err)=>{
console.log("===>ActsGetDoNotDisturbTest_test_0200 err===>"+JSON.stringify(err)) console.log("===>ActsGetDoNotDisturbTest_test_0200 err===>"+JSON.stringify(err))
...@@ -90,8 +90,8 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -90,8 +90,8 @@ describe('ActsAnsDoNotDisturbTest', function () {
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate((err,data)=>{
console.log("===>test_0300 getDoNotDisturbDate===>"+err.code+JSON.stringify(data)) console.log("===>test_0300 getDoNotDisturbDate===>"+err.code+JSON.stringify(data))
expect(data.type).assertEqual(0); expect(data.type).assertEqual(0);
expect(data.begin).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
expect(data.end).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
done(); done();
}) })
}) })
...@@ -113,8 +113,8 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -113,8 +113,8 @@ describe('ActsAnsDoNotDisturbTest', function () {
await notify.getDoNotDisturbDate().then((data)=>{ await notify.getDoNotDisturbDate().then((data)=>{
console.log("===>test_0400 getDoNotDisturbDate===>"+JSON.stringify(data)); console.log("===>test_0400 getDoNotDisturbDate===>"+JSON.stringify(data));
expect(data.type).assertEqual(0); expect(data.type).assertEqual(0);
expect(data.begin).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
expect(data.end).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Jan 01 1970 00:00:00 GMT+0000");
done(); done();
}) })
) )
...@@ -134,11 +134,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -134,11 +134,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
end:endDate end:endDate
},async(err) => { },async(err) => {
console.log("===>test_0500 success===>"+err.code); console.log("===>test_0500 success===>"+err.code);
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async (err,data)=>{
console.log("===>test_0500 getDoNotDisturbDate===>"+err.code+JSON.stringify(data)) console.log("===>test_0500 getDoNotDisturbDate===>"+err.code+JSON.stringify(data))
expect(data.type).assertEqual(1); expect(data.type).assertEqual(1);
expect(data.begin).assertEqual("Thu Jan 01 1970 12:10:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Jan 01 1970 12:10:00 GMT+0000");
expect(data.end).assertEqual("Thu Jan 01 1970 18:42:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Jan 01 1970 18:42:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -157,11 +163,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -157,11 +163,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then( }).then(
await notify.getDoNotDisturbDate().then((data)=>{ await notify.getDoNotDisturbDate().then(async(data)=>{
console.log("===>test_0600 success===>"+JSON.stringify(data)) console.log("===>test_0600 success===>"+JSON.stringify(data))
expect(data.type).assertEqual(1); expect(data.type).assertEqual(1);
expect(data.begin).assertEqual("Thu Jan 01 1970 08:13:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Jan 01 1970 08:13:00 GMT+0000");
expect(data.end).assertEqual("Thu Jan 01 1970 18:42:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Jan 01 1970 18:42:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
) )
...@@ -181,11 +193,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -181,11 +193,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
end:endDate end:endDate
},async(err) => { },async(err) => {
console.log("===>test_0700 success===>"+err.code) console.log("===>test_0700 success===>"+err.code)
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_0700 getDoNotDisturbDate===>"+JSON.stringify(data)) console.log("===>test_0700 getDoNotDisturbDate===>"+JSON.stringify(data))
expect(data.type).assertEqual(2); expect(data.type).assertEqual(2);
expect(data.begin).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000");
expect(data.end).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -206,11 +224,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -206,11 +224,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then( }).then(
notify.getDoNotDisturbDate().then((data)=>{ notify.getDoNotDisturbDate().then(async(data)=>{
console.log("===>test_0800 success===>"+JSON.stringify(data)) console.log("===>test_0800 success===>"+JSON.stringify(data))
expect(data.type).assertEqual(2); expect(data.type).assertEqual(2);
expect(data.begin).assertEqual("Sat Dec 18 2021 16:12:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sat Dec 18 2021 16:12:00 GMT+0000");
expect(data.end).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000"); expect(data.end.toString()).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
) )
...@@ -230,11 +254,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -230,11 +254,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
end:endDate end:endDate
},async(err) => { },async(err) => {
console.log("===>ActsSetDoNotDisturbTest_test_0900 success===>"+err.code) console.log("===>ActsSetDoNotDisturbTest_test_0900 success===>"+err.code)
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_0900 getDoNotDisturbDate===>"+JSON.stringify(data)) console.log("===>test_0900 getDoNotDisturbDate===>"+JSON.stringify(data))
expect(data.type).assertEqual(3); expect(data.type).assertEqual(3);
expect(data.begin).assertEqual("Sun Dec 19 2021 12:12:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 12:12:00 GMT+0000");
expect(data.end).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000"); expect(data.end.toString()).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -255,11 +285,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -255,11 +285,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then( }).then(
await notify.getDoNotDisturbDate().then((data)=>{ await notify.getDoNotDisturbDate().then(async(data)=>{
console.log("===>test_1000 getDoNotDisturbDate===>"+JSON.stringify(data)) console.log("===>test_1000 getDoNotDisturbDate===>"+JSON.stringify(data))
expect(data.type).assertEqual(3); expect(data.type).assertEqual(3);
expect(data.begin).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000");
expect(data.end).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
) )
...@@ -281,11 +317,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -281,11 +317,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
end:endDate end:endDate
},async(err) => { },async(err) => {
console.log("===>test_1100 success===>"+err.code) console.log("===>test_1100 success===>"+err.code)
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_1100 getDoNotDisturbDate===>"+err.code+JSON.stringify(data)) console.log("===>test_1100 getDoNotDisturbDate===>"+err.code+JSON.stringify(data))
expect(data.type).assertEqual(2); expect(data.type).assertEqual(2);
expect(data.begin).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000");
expect(data.end).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000"); expect(data.end.toString()).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -306,15 +348,27 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -306,15 +348,27 @@ describe('ActsAnsDoNotDisturbTest', function () {
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then( }).then(
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_1200 getDoNotDisturbDate===>"+err.code+JSON.stringify(data)) console.log("===>test_1200 getDoNotDisturbDate===>"+err.code+JSON.stringify(data));
expect(data.type).assertEqual(2); expect(data.type).assertEqual(2);
expect(data.begin).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000");
expect(data.end).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000"); expect(data.end.toString()).assertEqual("Wed Dec 22 2021 12:18:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
).catch((err)=>{ ).catch(async(err)=>{
console.log("===>test_1200 getDoNotDisturbDate fail===>"+JSON.stringify(err)) console.log("===>test_1200 getDoNotDisturbDate fail===>"+JSON.stringify(err))
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -335,11 +389,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -335,11 +389,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
end:endDate end:endDate
},async(err) => { },async(err) => {
console.log("===>test_1300 success===>"+err.code) console.log("===>test_1300 success===>"+err.code)
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_1300 getDoNotDisturbDate success===>"+err.code+JSON.stringify(data)) console.log("===>test_1300 getDoNotDisturbDate success===>"+err.code+JSON.stringify(data))
expect(data.type).assertEqual(2); expect(data.type).assertEqual(2);
expect(data.begin).assertEqual("Thu Dec 23 2021 12:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Dec 23 2021 12:18:00 GMT+0000");
expect(data.end).assertEqual("Wed Dec 22 2021 02:18:00 GMT+0000"); expect(data.end.toString()).assertEqual("Wed Dec 22 2021 02:18:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -360,15 +420,27 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -360,15 +420,27 @@ describe('ActsAnsDoNotDisturbTest', function () {
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then( }).then(
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_1400 getDoNotDisturbDate===>"+err.code+JSON.stringify(data)) console.log("===>test_1400 getDoNotDisturbDate===>"+err.code+JSON.stringify(data))
expect(data.type).assertEqual(2); expect(data.type).assertEqual(2);
expect(data.begin).assertEqual("Thu Dec 23 2021 12:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Thu Dec 23 2021 12:18:00 GMT+0000");
expect(data.end).assertEqual("Wed Dec 22 2021 02:18:00 GMT+0000"); expect(data.end.toString()).assertEqual("Wed Dec 22 2021 02:18:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
).catch((err)=>{ ).catch(async(err)=>{
console.log("===>test_1400 getDoNotDisturbDate fail===>"+JSON.stringify(err)) console.log("===>test_1400 getDoNotDisturbDate fail===>"+JSON.stringify(err))
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -387,9 +459,15 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -387,9 +459,15 @@ describe('ActsAnsDoNotDisturbTest', function () {
type:notify.DoNotDisturbType.TYPE_CLEARLY, type:notify.DoNotDisturbType.TYPE_CLEARLY,
begin:beginDate, begin:beginDate,
end:endDate end:endDate
},(err) => { },async(err) => {
console.log("===>ActsSetDoNotDisturbTest_test_1500 success===>"+err.code); console.log("===>ActsSetDoNotDisturbTest_test_1500 success===>"+err.code);
expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM); expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM);
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -408,9 +486,15 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -408,9 +486,15 @@ describe('ActsAnsDoNotDisturbTest', function () {
type:notify.DoNotDisturbType.TYPE_CLEARLY, type:notify.DoNotDisturbType.TYPE_CLEARLY,
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then().catch((err)=>{ }).then().catch(async(err)=>{
console.log("===>test_1600 fail===>"+JSON.stringify(err)); console.log("===>test_1600 fail===>"+JSON.stringify(err));
expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM); expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM);
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -432,6 +516,12 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -432,6 +516,12 @@ describe('ActsAnsDoNotDisturbTest', function () {
},async(err)=>{ },async(err)=>{
console.log("===>test_1700 setDoNotDisturbDate===>"+JSON.stringify(err)); console.log("===>test_1700 setDoNotDisturbDate===>"+JSON.stringify(err));
expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM); expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM);
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
...@@ -449,9 +539,15 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -449,9 +539,15 @@ describe('ActsAnsDoNotDisturbTest', function () {
type:notify.DoNotDisturbType.TYPE_CLEARLY, type:notify.DoNotDisturbType.TYPE_CLEARLY,
begin:beginDate, begin:beginDate,
end:endDate end:endDate
}).then().catch((err)=>{ }).then().catch(async(err)=>{
console.log("===>test_1800 setDoNotDisturbDate fail===>"+JSON.stringify(err)) console.log("===>test_1800 setDoNotDisturbDate fail===>"+JSON.stringify(err))
expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM); expect(err.code).assertEqual(ERR_ANS_INVALID_PARAM);
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}) })
...@@ -504,14 +600,20 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -504,14 +600,20 @@ describe('ActsAnsDoNotDisturbTest', function () {
onDoNotDisturbDateChange:async(data)=>{ onDoNotDisturbDateChange:async(data)=>{
console.debug("==>disturbModeCallbacka data==>" +JSON.stringify(data)); console.debug("==>disturbModeCallbacka data==>" +JSON.stringify(data));
expect(data.type).assertEqual(3); expect(data.type).assertEqual(3);
expect(data.begin).assertEqual("Sun Dec 19 2021 09:34:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 09:34:00 GMT+0000");
expect(data.end).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000"); expect(data.end.toString()).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000");
await notify.getDoNotDisturbDate((err,data)=>{ await notify.getDoNotDisturbDate(async(err,data)=>{
console.log("===>test_2100 getDoNotDisturbDate===>"+err.code+JSON.stringify(data)) console.log("===>test_2100 getDoNotDisturbDate===>"+err.code+JSON.stringify(data))
notify.unsubscribe(subInfo, unSubscribeCallbacka); notify.unsubscribe(subInfo, unSubscribeCallbacka);
expect(data.type).assertEqual(3); expect(data.type).assertEqual(3);
expect(data.begin).assertEqual("Sun Dec 19 2021 09:34:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 09:34:00 GMT+0000");
expect(data.end).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000"); expect(data.end.toString()).assertEqual("Sun Dec 19 2021 16:12:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}, },
...@@ -539,14 +641,20 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -539,14 +641,20 @@ describe('ActsAnsDoNotDisturbTest', function () {
onDoNotDisturbDateChange:async(data)=>{ onDoNotDisturbDateChange:async(data)=>{
console.debug("==>disturbModeCallbackb data==>" +JSON.stringify(data)); console.debug("==>disturbModeCallbackb data==>" +JSON.stringify(data));
expect(data.type).assertEqual(3); expect(data.type).assertEqual(3);
expect(data.begin).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000");
expect(data.end).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000");
await notify.getDoNotDisturbDate().then((data)=>{ await notify.getDoNotDisturbDate().then(async(data)=>{
console.log("===>test_2200 getDoNotDisturbDate===>"+JSON.stringify(data)); console.log("===>test_2200 getDoNotDisturbDate===>"+JSON.stringify(data));
notify.unsubscribe(subInfo, unSubscribeCallbackb); notify.unsubscribe(subInfo, unSubscribeCallbackb);
expect(data.type).assertEqual(3); expect(data.type).assertEqual(3);
expect(data.begin).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000"); expect(data.begin.toString()).assertEqual("Sun Dec 19 2021 08:18:00 GMT+0000");
expect(data.end).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000"); expect(data.end.toString()).assertEqual("Thu Dec 23 2021 00:46:00 GMT+0000");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}) })
}, },
...@@ -600,10 +708,14 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -600,10 +708,14 @@ describe('ActsAnsDoNotDisturbTest', function () {
function onConsume(data){ function onConsume(data){
console.log("===test_2500 onConsume===>"+JSON.stringify(data)); console.log("===test_2500 onConsume===>"+JSON.stringify(data));
expect(data.sound).assertEqual("normalSocialMusic"); var hashCode = data.request.hashCode
console.log("===test_2500 onConsume sound===>"+data.sound); var sound = data.sortingMap.sortings[hashCode].slot.sound
expect(JSON.stringify(data.vibrationValues)).assertEqual(JSON.stringify([1,0,1,0,1,0])); console.log("===test_2500 onConsume sound===>"+sound);
console.log("===test_2500 onConsume vibrationValues===>"+data.vibrationValues); expect(sound).assertEqual("normalSocialMusic");
var vibra = data.sortingMap.sortings[hashCode].slot.vibrationValues
console.log("===test_2500 onConsume vibra===>"+vibra);
expect(JSON.stringify(vibra)).assertEqual(JSON.stringify([1,0,1,0,1,0]));
console.log("===test_2500 onConsume end===>");
} }
function publishCallback(err){ function publishCallback(err){
console.log("===publishCallback===>"+JSON.stringify(err)); console.log("===publishCallback===>"+JSON.stringify(err));
...@@ -677,10 +789,19 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -677,10 +789,19 @@ describe('ActsAnsDoNotDisturbTest', function () {
},publishCallback); },publishCallback);
setTimeout((async function(){ setTimeout((async function(){
console.info("===test_2500 setTimeout===>"); console.info("===test_2500 setTimeout===>");
notify.unsubscribe(subscriber); await notify.unsubscribe(subscriber);
console.info("===test_2500 setTimeout unsubscribe===>"); console.info("===test_2500 setTimeout unsubscribe===>");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
});
console.info("====test_2500 setDoNotDisturbDate removeSlot============>");
await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION);
console.info("====test_2500 setTimeout removeSlot============>");
done(); done();
}),300); }),500);
}) })
function onDoNotDisturbDateChange2600(mode){ function onDoNotDisturbDateChange2600(mode){
...@@ -690,10 +811,14 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -690,10 +811,14 @@ describe('ActsAnsDoNotDisturbTest', function () {
function onConsume2600(data){ function onConsume2600(data){
console.log("===test_2600 onConsume===>"+JSON.stringify(data)); console.log("===test_2600 onConsume===>"+JSON.stringify(data));
expect(data.sound).assertEqual("normalSocialMusic"); var hashCode = data.request.hashCode
console.log("===test_2600 onConsume sound===>"+data.sound); var sound = data.sortingMap.sortings[hashCode].slot.sound
expect(JSON.stringify(data.vibrationValues)).assertEqual(JSON.stringify([1,0,1,0,1,0])); console.log("===test_2600 onConsume sound===>"+sound);
console.log("===test_2600 onConsume vibrationValues===>"+data.vibrationValues); expect(sound).assertEqual("normalSocialMusic");
var vibra = data.sortingMap.sortings[hashCode].slot.vibrationValues
console.log("===test_2600 onConsume vibra===>"+vibra);
expect(JSON.stringify(vibra)).assertEqual(JSON.stringify([1,0,1,0,1,0]));
console.log("===test_2600 onConsume end===>");
} }
/* /*
...@@ -764,10 +889,19 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -764,10 +889,19 @@ describe('ActsAnsDoNotDisturbTest', function () {
},publishCallback); },publishCallback);
setTimeout((async function(){ setTimeout((async function(){
console.info("====test_2600 setTimeout====>"); console.info("====test_2600 setTimeout====>");
notify.unsubscribe(subscriber); await notify.unsubscribe(subscriber);
console.info("====test_2600 setTimeout unsubscribe====>"); console.info("====test_2600 setTimeout unsubscribe====>");
await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION);
console.info("====test_2600 setTimeout removeSlot============>");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
console.info("====test_2600 setTimeout setDoNotDisturbDate============>");
done(); done();
}),300); }),500);
}) })
function onDoNotDisturbDateChange2700(mode){ function onDoNotDisturbDateChange2700(mode){
...@@ -777,10 +911,14 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -777,10 +911,14 @@ describe('ActsAnsDoNotDisturbTest', function () {
function onConsume2700(data){ function onConsume2700(data){
console.log("===test_2700 onConsume===>"+JSON.stringify(data)); console.log("===test_2700 onConsume===>"+JSON.stringify(data));
expect(data.sound).assertEqual("normalSocialMusic"); var hashCode = data.request.hashCode
console.log("===test_2700 onConsume sound===>"+data.sound); var sound = data.sortingMap.sortings[hashCode].slot.sound
expect(JSON.stringify(data.vibrationValues)).assertEqual(JSON.stringify([1,0,1,0,1,0])); console.log("===test_2700 onConsume sound===>"+sound);
console.log("===test_2700 onConsume vibrationValues===>"+data.vibrationValues); expect(sound).assertEqual("normalSocialMusic");
var vibra = data.sortingMap.sortings[hashCode].slot.vibrationValues
console.log("===test_2700 onConsume vibra===>"+vibra);
expect(JSON.stringify(vibra)).assertEqual(JSON.stringify([1,0,1,0,1,0]));
console.log("===test_2700 onConsume end===>");
} }
/* /*
...@@ -851,10 +989,18 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -851,10 +989,18 @@ describe('ActsAnsDoNotDisturbTest', function () {
},publishCallback); },publishCallback);
setTimeout((async function(){ setTimeout((async function(){
console.info("====test_2700 setTimeout====>"); console.info("====test_2700 setTimeout====>");
notify.unsubscribe(subscriber); await notify.unsubscribe(subscriber);
console.info("====test_2700 setTimeout unsubscribe============>"); console.info("====test_2700 setTimeout unsubscribe============>");
await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION);
console.info("====test_2700 setTimeout removeSlot============>");
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}),300); }),500);
}) })
function onDoNotDisturbDateChange2800(mode){ function onDoNotDisturbDateChange2800(mode){
...@@ -864,10 +1010,14 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -864,10 +1010,14 @@ describe('ActsAnsDoNotDisturbTest', function () {
function onConsume2800(data){ function onConsume2800(data){
console.log("===test_2800 onConsume===>"+JSON.stringify(data)); console.log("===test_2800 onConsume===>"+JSON.stringify(data));
expect(data.sound).assertEqual("normalSocialMusic"); var hashCode = data.request.hashCode
console.log("===test_2800 onConsume sound===>"+data.sound); var sound = data.sortingMap.sortings[hashCode].slot.sound
expect(JSON.stringify(data.vibrationValues)).assertEqual(JSON.stringify([1,0,1,0,1,0])); console.log("===test_2800 onConsume sound===>"+sound);
console.log("===test_2800 onConsume vibrationValues===>"+data.vibrationValues); expect(sound).assertEqual("normalSocialMusic");
var vibra = data.sortingMap.sortings[hashCode].slot.vibrationValues
console.log("===test_2800 onConsume vibra===>"+vibra);
expect(JSON.stringify(vibra)).assertEqual(JSON.stringify([1,0,1,0,1,0]));
console.log("===test_2800 onConsume end===>");
} }
/* /*
...@@ -938,10 +1088,17 @@ describe('ActsAnsDoNotDisturbTest', function () { ...@@ -938,10 +1088,17 @@ describe('ActsAnsDoNotDisturbTest', function () {
},publishCallback); },publishCallback);
setTimeout((async function(){ setTimeout((async function(){
console.info("======test_2800 setTimeout============>"); console.info("======test_2800 setTimeout============>");
notify.unsubscribe(subscriber); await notify.unsubscribe(subscriber);
console.info("======test_2800 setTimeout unsubscribe============>"); console.info("======test_2800 setTimeout unsubscribe============>");
await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION);
await notify.setDoNotDisturbDate(
{
type:notify.DoNotDisturbType.TYPE_NONE,
begin:beginDate,
end:endDate
})
done(); done();
}),300); }),500);
}) })
}) })
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册