From b42b2a832a5911c94325926724d4a2dc715be509 Mon Sep 17 00:00:00 2001 From: gaoxi785 Date: Tue, 22 Aug 2023 16:26:03 +0800 Subject: [PATCH] selectContacts Signed-off-by: gaoxi785 --- .../src/main/ets/test/contactstage.test.ets | 106 ++++++++++++++++++ .../js/test/NetworkManagerRegister.test.js | 1 + 2 files changed, 107 insertions(+) diff --git a/telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/contactstage.test.ets b/telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/contactstage.test.ets index 2ffef4484..68e7a291e 100644 --- a/telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/contactstage.test.ets +++ b/telephony/telephonyjstest/actscontactstageapitest/entry/src/main/ets/test/contactstage.test.ets @@ -1634,5 +1634,111 @@ export default function ContactInterfaceStageTest() { }); sleep(500); }); + + /** + * @tc.number SUB_Telephony_ContactsApi_selectContacts_test_0100 + * @tc.name contactsApi_selectContacts error + * @tc.desc Function test + */ + it("SUB_Telephony_ContactsApi_selectContacts_test_0100", 0, async function (done) { + contact.addContact(globalThis.context, contactData, (err, data) => { + if (!err) { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0100 data = " + JSON.stringify(data)); + expect(data > 0).assertTrue(); + done(); + return; + } + contact.selectContacts((err, data) => { + if (err) { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0100 err = " + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + return; + } + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0100 data = " + JSON.stringify(data)); + done(); + }); + }); + sleep(500); + }); + + /** + * @tc.number SUB_Telephony_ContactsApi_selectContacts_test_0200 + * @tc.name contactsApi_selectContacts error + * @tc.desc Function test + */ + it("SUB_Telephony_ContactsApi_selectContacts_test_0200", 0, async function (done) { + contact.addContact(globalThis.context, contactData, (err, data) => { + if (!err) { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0200 data = " + JSON.stringify(data)); + expect(data > 0).assertTrue(); + done(); + return; + } + contact.selectContacts().then((data) => { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0200 data = " + JSON.stringify(data)); + done(); + }).catch((err) => { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0200 err = " + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + return; + }); + }); + sleep(500); + }); + + /** + * @tc.number SUB_Telephony_ContactsApi_selectContacts_test_0300 + * @tc.name contactsApi_selectContacts error + * @tc.desc Function test + */ + it("SUB_Telephony_ContactsApi_selectContacts_test_0300", 0, async function (done) { + contact.addContact(globalThis.context, contactData, (err, data) => { + if (!err) { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0300 data = " + JSON.stringify(data)); + expect(data > 0).assertTrue(); + done(); + return; + } + contact.selectContacts({isMultiSelect : false}, (err, data) => { + if (err) { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0300 err = " + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + return; + } + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0300 data = " + JSON.stringify(data)); + done(); + }); + }); + sleep(500); + }); + + /** + * @tc.number SUB_Telephony_ContactsApi_selectContacts_test_0400 + * @tc.name contactsApi_selectContacts error + * @tc.desc Function test + */ + it("SUB_Telephony_ContactsApi_selectContacts_test_0400", 0, async function (done) { + contact.addContact(globalThis.context, contactData, (err, data) => { + if (!err) { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0400 data = " + JSON.stringify(data)); + expect(data > 0).assertTrue(); + done(); + return; + } + contact.selectContacts({isMultiSelect : false}).then((data) => { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0400 data = " + JSON.stringify(data)); + done(); + }).catch((err) => { + console.info("SUB_Telephony_ContactsApi_selectContacts_test_0400 err = " + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + return; + }); + }); + sleep(500); + }); }); } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js index 3a65b7127..5a714fb77 100644 --- a/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js @@ -44,6 +44,7 @@ export default function Telephony_NetworkManagerRegisterTest() { }); netConn.on('netCapabilitiesChange', function (value) { console.log("netCapabilitiesChange " + JSON.stringify(value)); + expect(value.NetHandle !== undefined).assertTrue(); }); netConn.on('netConnectionPropertiesChange', function (value) { console.log("netConnectionPropertiesChange" + JSON.stringify(value)); -- GitLab