diff --git a/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js index f34e106c1fa2f42f233ab8c16db493ff95428ca4..15b4d23ee549acac1d8a7c607120fa4a056a7560 100644 --- a/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js +++ b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js @@ -54,6 +54,13 @@ export default function ActsNotificationWantAgentTest() { } } + beforeEach(async function (done) { + console.info(`${TAG} beforeEach START`) + WantAgent = {} + console.info(`${TAG} aftebeforeEachEach END`) + done(); + }) + /* * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100 * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void @@ -62,7 +69,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100 START`) WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.ONE_TIME_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.ONE_TIME_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -86,7 +93,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0200', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0200 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.NO_BUILD_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.NO_BUILD_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -110,7 +117,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0300', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0300 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -134,7 +141,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0400', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0400 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -158,7 +165,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0500', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0500 START`) WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CONSTANT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.CONSTANT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -182,7 +189,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0600', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0600 START`) WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ELEMENT + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ELEMENT] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -206,7 +213,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0700', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0700 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ACTION + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ACTION] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -230,7 +237,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0800', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0800 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_URI + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_URI] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -254,7 +261,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0900', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0900 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ENTITIES + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ENTITIES] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -278,7 +285,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1000', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1000 START`) WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_BUNDLE + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_BUNDLE] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -302,7 +309,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1100', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1100 START`) WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.ONE_TIME_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.ONE_TIME_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -324,7 +331,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1200', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1200 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.NO_BUILD_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.NO_BUILD_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -346,7 +353,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1300', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1300 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -368,7 +375,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1400', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1400 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -390,7 +397,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1500', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1500 START`) WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CONSTANT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.CONSTANT_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -412,7 +419,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1600', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1600 START`) WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ELEMENT + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ELEMENT] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -434,7 +441,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1700', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1700 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ACTION + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ACTION] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -456,7 +463,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1800', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1800 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_URI + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_URI] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -478,7 +485,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1900', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1900 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ENTITIES + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ENTITIES] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -500,7 +507,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2000', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2000 START`) WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_BUNDLE + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_BUNDLE] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) @@ -522,7 +529,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -534,19 +541,19 @@ export default function ActsNotificationWantAgentTest() { expect(true).assertTrue() done() } + wantAgent.cancel(WantAgent, (err) => { + if (err.code) { + console.info(`${TAG} cancel AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} cancel AsyncCallback success`) + expect(true).assertTrue() + done() + } + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100 END`) + }) }) - wantAgent.cancel(WantAgent, (err) => { - if (err.code) { - console.info(`${TAG} cancel AsyncCallback err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} cancel AsyncCallback success`) - expect(true).assertTrue() - done() - } - }) - console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100 END`) }) /* @@ -557,26 +564,26 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() + wantAgent.cancel(WantAgent).then(() => { + console.info(`${TAG} cancel Promise success`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} cancel Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) }).catch((err) => { console.info(`${TAG} getWantAgent Promise err: ${err.code}`) expect(false).assertTrue() done() }) - wantAgent.cancel(WantAgent).then(() => { - console.info(`${TAG} cancel Promise success`) - expect(true).assertTrue() - done() - }).catch((err) => { - console.info(`${TAG} cancel Promise err: ${err.code}`) - expect(false).assertTrue() - done() - }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200 END`) }) @@ -588,7 +595,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -598,21 +605,19 @@ export default function ActsNotificationWantAgentTest() { WantAgent = data console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() - } - }) - wantAgent.getBundleName(WantAgent, (err, data) => { - if (err.code) { - console.info(`${TAG} getBundleName AsyncCallback err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} getBundleName AsyncCallback success: ${JSON.stringify(data)}`) - expect(data).assertEqual('com.example.actsnotificationwantagent') - done() + wantAgent.getBundleName(WantAgent, (err, data) => { + if (err.code) { + console.info(`${TAG} getBundleName AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getBundleName AsyncCallback success: ${JSON.stringify(data)}`) + expect(data).assertEqual('com.example.actsnotificationwantagent') + done() + } + }) } }) - console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300 END`) }) @@ -624,18 +629,12 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG - wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() - }).catch((err) => { - console.info(`${TAG} getWantAgent Promise err: ${err.code}`) - expect(false).assertTrue() - done() - }) - wantAgent.getBundleName(WantAgent) + wantAgent.getBundleName(WantAgent) .then((data) => { console.info(`${TAG} getBundleName Promise success: ${JSON.stringify(data)}`) expect(data).assertEqual('com.example.actsnotificationwantagent') @@ -646,6 +645,12 @@ export default function ActsNotificationWantAgentTest() { expect(false).assertTrue() done() }) + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400 END`) }) @@ -657,7 +662,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -667,20 +672,20 @@ export default function ActsNotificationWantAgentTest() { WantAgent = data console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() - } - }) - await wantAgent.getUid(WantAgent, (err, data) => { - if (err.code) { - console.info(`${TAG} getUid AsyncCallback err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} getUid AsyncCallback success: ${JSON.stringify(data)}`) - expect(true).assertTrue() - done() + wantAgent.getUid(WantAgent, (err, data) => { + if (err.code) { + console.info(`${TAG} getUid AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getUid AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) } }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500 END`) }) @@ -692,26 +697,26 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() + wantAgent.getUid(WantAgent).then((data) => { + console.info(`${TAG} getUid Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getUid Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) }).catch((err) => { console.info(`${TAG} getWantAgent Promise err: ${err.code}`) expect(false).assertTrue() done() }) - await wantAgent.getUid(WantAgent).then((data) => { - console.info(`${TAG} getUid Promise success: ${JSON.stringify(data)}`) - expect(true).assertTrue() - done() - }).catch((err) => { - console.info(`${TAG} getUid Promise err: ${err.code}`) - expect(false).assertTrue() - done() - }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600 END`) }) @@ -723,7 +728,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2700', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2700 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -758,7 +763,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2800', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2800 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -792,7 +797,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) @@ -802,20 +807,20 @@ export default function ActsNotificationWantAgentTest() { WantAgent = data console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() - } - }) - await wantAgent.getOperationType(WantAgent, (err, data) => { - if (err.code) { - console.info(`${TAG} getOperationType AsyncCallback err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} getOperationType AsyncCallback success: ${JSON.stringify(data)}`) - expect(true).assertTrue() - done() + wantAgent.getOperationType(WantAgent, (err, data) => { + if (err.code) { + console.info(`${TAG} getOperationType AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getOperationType AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) } }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900 END`) }) @@ -827,18 +832,12 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo).then((data) => { WantAgent = data console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) expect(true).assertTrue() - done() - }).catch((err) => { - console.info(`${TAG} getWantAgent Promise err: ${err.code}`) - expect(false).assertTrue() - done() - }) - await wantAgent.getOperationType(WantAgent) + wantAgent.getOperationType(WantAgent) .then((data) => { console.info(`${TAG} getOperationType Promise success: ${JSON.stringify(data)}`) expect(true).assertTrue() @@ -849,6 +848,12 @@ export default function ActsNotificationWantAgentTest() { expect(false).assertTrue() done() }) + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000 END`) }) @@ -860,7 +865,7 @@ export default function ActsNotificationWantAgentTest() { it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3100', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3100 START`) WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY - WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] wantAgent.getWantAgent(WantAgentInfo, (err, data) => { if (err.code) { console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`)