diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js index 6ad015b7403825375f6b76e1b6335fdccb2eaef8..7f9923fb5cb89d9cd8caffba8502bb0a948ae0e1 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js @@ -26,6 +26,7 @@ var time = 1000 export default function ActsAnsGetWantAgentInfoTest() { describe('ActsAnsGetWantAgentInfoTest', function () { console.info('----ActsGetWantAgentInfoTest----'); + /* * @tc.number: ACTS_SetWantInfo_0100 * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() @@ -107,6 +108,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }, time); console.info('----getWantAgenta after----'); }) + /* * @tc.number: ACTS_SetWantInfo_0200 * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() @@ -170,6 +172,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_0200====>"); }, time) }) + /* * @tc.number: ACTS_SetWantInfo_0300 * @tc.name: equal(normal) @@ -372,6 +375,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); }, 1000); }) + /* * @tc.number: ACTS_SetWantInfo_0500 * @tc.name: equal(),cancel() @@ -472,6 +476,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); }, 1000); }) + /* * @tc.number: ACTS_SetWantInfo_0600 * @tc.name: equal() @@ -494,20 +499,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_0600====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_0700 * @tc.name: equal() * @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")promise */ it('ACTS_SetWantInfo_0700', 0, async function (done) { - var promise = await wantAgent.equal("$%$%^$%^","$%$%^$%^") - console.info('----equali success!----'+promise) - expect(promise).assertEqual(undefined); + wantAgent.equal("$%$%^$%^","$%$%^$%^").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_0700====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_0800 * @tc.name: equal() @@ -525,20 +534,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_0800====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_0900 * @tc.name: equal() * @tc.desc: verify the function of equal({},{})promise */ it('ACTS_SetWantInfo_0900', 0, async function (done) { - var promise = wantAgent.equal({},{}) - console.info('----equalk success!----'+promise) - expect(promise).assertEqual(null); + wantAgent.equal({},{}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_0900====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_1000 * @tc.name: equal() @@ -556,20 +569,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1000====>"); }, time); }); + /* - * @tc.number: ACTS_SetWantInfo_2200 + * @tc.number: ACTS_SetWantInfo_1100 * @tc.name: equal() * @tc.desc: verify the function of equal(100,100)promise */ it('ACTS_SetWantInfo_1100', 0, async function (done) { - var promise = await wantAgent.equal(100,100) - console.info('----equaln success!----'+promise) - expect(promise).assertEqual(undefined); + wantAgent.equal(100,100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1100====>"); }, time); }); + /* * @tc.number: ACTS_SetWantInfo_1200 * @tc.name: getWantAgent() @@ -584,6 +601,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1200====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1300 * @tc.name: getWantAgent() @@ -591,14 +609,17 @@ describe('ActsAnsGetWantAgentInfoTest', function () { */ it('ACTS_SetWantInfo_1300', 0, async function (done) { console.info('----ACTS_SetWantInfo_0300 begin----'); - var promise = wantAgent.getWantAgent("") - console.log("===getWantAgentb==="+promise) - expect(promise).assertEqual(null); + wantAgent.getWantAgent("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1300====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1400 * @tc.name: getBundleName() @@ -613,20 +634,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1400====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1500 * @tc.name: getBundleName() * @tc.desc: verify the function of getBundleName("")promise */ it('ACTS_SetWantInfo_1500', 0, async function (done) { - var promise = await wantAgent.getBundleName("") - console.info('----getBundleNameb success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getBundleName("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1500====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1600 * @tc.name: getUid() @@ -641,20 +666,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1600====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1700 * @tc.name: getUid() * @tc.desc: verify the function of getUid("")promise */ it('ACTS_SetWantInfo_1700', 0, async function (done) { - var promise =await wantAgent.getUid("") - console.info('----getUidb success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getUid("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1700====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1800 * @tc.name: getWant() @@ -670,20 +699,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_1800====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_1900 * @tc.name: getWant() * @tc.desc: verify the function of getWant("")promise */ it('ACTS_SetWantInfo_1900', 0, async function (done) { - var promise = await wantAgent.getWant("") - console.info('----getWantb success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getWant("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_1900====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2000 * @tc.name: getWantAgent() @@ -699,20 +732,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2000====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2100 * @tc.name: getWantAgent() * @tc.desc: verify the function of getWantAgent(100)promises */ it('ACTS_SetWantInfo_2100', 0, async function (done) { - var promise = wantAgent.getWantAgent(100) - console.log("----getWantAgentb success!----"+promise) - expect(promise).assertEqual(null) + wantAgent.getWantAgent(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done(); setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2100====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2200 * @tc.name: getBundleName() @@ -728,20 +765,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2200====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2300 * @tc.name: getBundleName() * @tc.desc: verify the function of getBundleName(100)promise */ it('ACTS_SetWantInfo_2300', 0, async function (done) { - var promise =await wantAgent.getBundleName(100) - console.info('----getBundleNamed success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getBundleName(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2300====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2400 * @tc.name: getUid() @@ -756,20 +797,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2400====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2500 * @tc.name: getUid() * @tc.desc: verify the function of getUid(100)promise */ it('ACTS_SetWantInfo_2500', 0, async function (done) { - var promise =await wantAgent.getUid(100) - console.info('----getUidd success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getUid(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2500====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2600 * @tc.name: getWant() @@ -785,20 +830,24 @@ describe('ActsAnsGetWantAgentInfoTest', function () { console.debug("====>time out ACTS_SetWantInfo_2600====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2700 * @tc.name: getWant() * @tc.desc: verify the function of getWant(100)promise */ it('ACTS_SetWantInfo_2700', 0, async function (done) { - var promise = await wantAgent.getWant(100) - console.info('----getWantd success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.getWant(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() setTimeout(function(){ console.debug("====>time out ACTS_SetWantInfo_2700====>"); }, time); }) + /* * @tc.number: ACTS_SetWantInfo_2800 * @tc.name: getWantAgent() @@ -811,6 +860,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }) done(); }) + /* * @tc.number: ACTS_SetWantInfo_2900 * @tc.name: getWantAgent() @@ -824,6 +874,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }) done(); }) + /* * @tc.number: ACTS_SetWantInfo_3000 * @tc.name: getBundleName() @@ -836,17 +887,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3100 * @tc.name: getBundleName() * @tc.desc: verify the function of getBundleName({})promise */ it('ACTS_SetWantInfo_3100', 0, async function (done) { - var promise = wantAgent.getBundleName({}) - console.info('----getBundleNamef success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.getBundleName({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3200 * @tc.name: getUid() @@ -858,17 +913,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3300 * @tc.name: getUid() * @tc.desc: verify the function of getUid({})promise */ it('ACTS_SetWantInfo_3300', 0, async function (done) { - var promise = wantAgent.getUid({}) - console.info('----getUidf success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.getUid({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3400 * @tc.name: getWant() @@ -880,17 +939,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3500 * @tc.name: getWant() * @tc.desc: verify the function of getWant({})promise */ it('ACTS_SetWantInfo_3500', 0, async function (done) { - var promise = wantAgent.getWant({}) - console.info('----getWantf success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.getWant({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3600 * @tc.name: cancel() @@ -902,17 +965,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3700 * @tc.name: cancel() * @tc.desc: verify the function of cancel({})promise */ it('ACTS_SetWantInfo_3700', 0, async function (done) { - var promise = await wantAgent.cancel({}) - console.info('----cancelb success!----'+promise); - expect(promise).assertEqual(null) - done() + wantAgent.cancel({}).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) + done() }) + /* * @tc.number: ACTS_SetWantInfo_3800 * @tc.name: cancel() @@ -924,17 +991,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_3900 * @tc.name: cancel() * @tc.desc: verify the function of cancel(100)promise */ it('ACTS_SetWantInfo_3900', 0, async function (done) { - var promise =await wantAgent.cancel(100) - console.info('----canceld success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.cancel(100).then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() }) + /* * @tc.number: ACTS_SetWantInfo_4000 * @tc.name: getWant() @@ -946,17 +1017,21 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_4100 * @tc.name: cancel() * @tc.desc: verify the function of cancel("")promise */ it('ACTS_SetWantInfo_4100', 0, async function (done) { - var promise = await wantAgent.cancel("") - console.info('----cancelf success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.cancel("").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() }) + /* * @tc.number: ACTS_SetWantInfo_4200 * @tc.name: cancel() @@ -968,15 +1043,18 @@ describe('ActsAnsGetWantAgentInfoTest', function () { }); done() }) + /* * @tc.number: ACTS_SetWantInfo_4300 * @tc.name: cancel() * @tc.desc: verify the function of cancel("%^%^%^")promise */ it('ACTS_SetWantInfo_4300', 0, async function (done) { - var promise =await wantAgent.cancel("%^%^%^") - console.info('----cancelh success!----'+promise); - expect(promise).assertEqual(undefined) + wantAgent.cancel("%^%^%^").then((error, data)=>{ + if(error.code) { + expect(error.code).assertEqual(-1) + } + }) done() }) }) diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js index c1e67bba1272adae3de9acdc7cf584e5383bdd06..81edb327766c9cb77e987aa0ac578d2247855d9d 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js @@ -47,7 +47,7 @@ describe('ActsAnsWantAgentFiveTest', function () { } }, ], -// operationType: wantAgent.OperationType.START_ABILITY, + operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] } @@ -75,9 +75,7 @@ describe('ActsAnsWantAgentFiveTest', function () { } ); } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); + expect(err.code).assertEqual(-1) } done(); diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js index 9e2155943184f01794032c7c32971e33a75a3ab4..be7898790bac53eaaeeb927fc149b8cce4900754 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js @@ -67,15 +67,17 @@ describe('ActsAnsWantAgentFiveProTest', function () { console.info('----trigger success!----'); console.info('== trigger data ' + JSON.stringify(data) ); } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); + expect(err.code).assertEqual(-1) } done(); } ); done(); } - ); + ).catch((err)=>{ + expect(err.code).assertEqual(-1) + done() + }) setTimeout(function(){ console.debug("====>time out ACTS_SetWant_1000====>"); }, time);