1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import contactsapi from "@ohos.contact"; 17import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index'; 18 19const URI_CONTACTS = "datashare:///com.ohos.contactsdataability"; 20const rawContactUri = "datashare:///com.ohos.contactsdataability/contacts/raw_contact"; 21const contactDataUri = "datashare:///com.ohos.contactsdataability/contacts/contact_data"; 22const groupUri = "datashare:///com.ohos.contactsdataability/contacts/groups"; 23const deletedUri = "datashare:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; 24 25describe('ObjectInterfaceTest', function() { 26 function sleep(numberMillis) 27 { 28 var now = new Date(); 29 var exitTime = now.getTime() + numberMillis; 30 while (true) { 31 now = new Date(); 32 if (now.getTime() > exitTime) 33 return; 34 } 35 } 36 37 var contactData = { 38 id : 0, 39 key : "0", 40 contactAttributes : {attributes : [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]}, 41 emails : [ {email : "email", labelName : "自定义邮箱", labelId : 1, displayName : "emailDisplayName"} ], 42 events : [ {eventDate : "event", labelName : "自定义event", labelId : 2} ], 43 groups : [ {groupId : 1, title : "群组"} ], 44 imAddresses : [ {imAddress : "imAddress", labelName : "自定义", labelId : 3} ], 45 phoneNumbers : [ {phoneNumber : "183", labelName : "自定义phoneNumbers", labelId : 4} ], 46 portrait : {uri : "content://head/0"}, 47 postalAddresses : [ { 48 city : "南京", 49 country : "中国", 50 labelName : "labelName", 51 neighborhood : "neighborhood", 52 pobox : "pobox", 53 postalAddress : "postalAddress", 54 postcode : "postcode", 55 region : "region", 56 street : "street", 57 labelId : 5 58 } ], 59 relations : [ {relationName : "relationName", labelName : "自定义relationName", labelId : 6} ], 60 sipAddresses : [ {sipAddress : "sipAddress", labelName : "自定义sipAddress", labelId : 6} ], 61 websites : [ {website : "website"} ], 62 name : { 63 familyName : "familyName", 64 familyNamePhonetic : "familyNamePhonetic", 65 fullName : "小李", 66 givenName : "givenName", 67 givenNamePhonetic : "givenNamePhonetic", 68 middleName : "middleName", 69 middleNamePhonetic : "middleNamePhonetic", 70 namePrefix : "namePrefix", 71 nameSuffix : "nameSuffix" 72 }, 73 nickName : {nickName : "nickName"}, 74 note : {noteContent : "note"}, 75 organization : {name : "TT", title : "开发"} 76 }; 77 78 var g_rawContactId; 79 var g_group; 80 81 /** 82 * @tc.number contactsApi_insert_test_100 83 * @tc.name Insert contact information 84 * @tc.desc Function test 85 */ 86 it("contactsApi_insert_test_100", 0, async function(done) { 87 contactsapi.addContact(contactData, (data) => { 88 console.info("contactsApi_insert_test_100 : data = " + data); 89 g_rawContactId = data; 90 expect(data > 0).assertTrue(); 91 done(); 92 }); 93 }); 94 95 /** 96 * @tc.number contactsApi_delete_test_200 97 * @tc.name Delete contact information 98 * @tc.desc Function test 99 */ 100 it("contactsApi_delete_test_200", 0, async function(done) { 101 var deleteId = g_rawContactId; 102 console.info("contactsApi_delete_test_200 : g_rawContactId = " + g_rawContactId); 103 contactsapi.deleteContact(1, (data) => { 104 var g_delete = data; 105 console.info("contactsApi_delete_test_200 : deleteCode = " + data); 106 expect(g_delete == 0).assertTrue(); 107 done(); 108 }); 109 }); 110 111 /** 112 * @tc.number contactsApi_update_test_300 113 * @tc.name Update contact information 114 * @tc.desc Function test 115 */ 116 it("contactsApi_update_test_300", 0, async function(done) { 117 var rawContactId = await contactsapi.addContact(contactData); 118 console.info("contactsApi_insert_test_300 : rawContactId = " + rawContactId); 119 g_rawContactId = rawContactId; 120 expect(rawContactId > 0).assertTrue(); 121 122 var updateValues = {id : g_rawContactId, name : {fullName : "小红"}}; 123 var condition = {attributes : [ 6 ]}; 124 contactsapi.updateContact(updateValues, condition, (data) => { 125 console.info("contactsApi_update_test_300 : updateCode = " + data); 126 expect(data == 0).assertTrue(); 127 done(); 128 }); 129 }); 130 131 /** 132 * @tc.number contactsApi_update_test_4100 133 * @tc.name Update contact information 134 * @tc.desc Function test 135 */ 136 it("contactsApi_update_test_4100", 0, async function(done) { 137 var rawContactId = await contactsapi.addContact(contactData); 138 console.info("contactsApi_insert_test_300 : rawContactId = " + rawContactId); 139 g_rawContactId = rawContactId; 140 expect(rawContactId > 0).assertTrue(); 141 142 var updateValues = {id : g_rawContactId, name : {fullName : "小红"}}; 143 contactsapi.updateContact(updateValues, (data) => { 144 console.info("contactsApi_update_test_4100 : updateCode = " + data); 145 expect(data == 0).assertTrue(); 146 done(); 147 }); 148 }); 149 150 /** 151 * @tc.number contactsApi_query_contact_test_400 152 * @tc.name Query contacts information 153 * @tc.desc Function test 154 */ 155 it("contactsApi_query_contact_test_400", 0, async function(done) { 156 var queryId = g_rawContactId; 157 contactsapi.queryContact(queryId, (data) => { 158 console.info("contactsApi_query_contact_test_400 : query resultSet = " + JSON.stringify(data)); 159 expect(data != null).assertTrue(); 160 done(); 161 }); 162 }); 163 164 /** 165 * @tc.number contactsApi_query_contact_test_500 166 * @tc.name Query contacts information 167 * @tc.desc Function test 168 */ 169 it("contactsApi_query_contact_test_500", 0, async function(done) { 170 var queryId = g_rawContactId.toString(); 171 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 172 contactsapi.queryContact(queryId, holder, (data) => { 173 console.info("contactsApi_query_contact_test_500 : query resultSet = " + JSON.stringify(data)); 174 expect(data != null).assertTrue(); 175 done(); 176 }); 177 }); 178 179 /** 180 * @tc.number contactsApi_query_contact_test_600 181 * @tc.name Query contacts information 182 * @tc.desc Function test 183 */ 184 it("contactsApi_query_contact_test_600", 0, async function(done) { 185 var queryId = g_rawContactId.toString(); 186 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 187 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 188 189 contactsapi.queryContact(queryId, holder, ContactAttributes, (data) => { 190 console.info("contactsApi_query_contact_test_600 : query resultSet = " + JSON.stringify(data)); 191 expect(data != null).assertTrue(); 192 done(); 193 }); 194 }); 195 196 /** 197 * @tc.number contactsApi_query_contact_test_4200 198 * @tc.name Query contacts information 199 * @tc.desc Function test 200 */ 201 it("contactsApi_query_contact_test_4200", 0, async function(done) { 202 var queryId = g_rawContactId.toString(); 203 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 204 205 contactsapi.queryContact(queryId, ContactAttributes, (data) => { 206 console.info("contactsApi_query_contact_test_4200 : query resultSet = " + JSON.stringify(data)); 207 expect(data != null).assertTrue(); 208 done(); 209 }); 210 }); 211 212 /** 213 * @tc.number contactsApi_query_contacts_test_700 214 * @tc.name Query contacts information 215 * @tc.desc Function test 216 */ 217 it("contactsApi_query_contacts_test_700", 0, async function(done) { 218 contactsapi.queryContacts((data) => { 219 console.info("contactsApi_query_contacts_test_700 : query resultSet = " + JSON.stringify(data)); 220 expect(data != null).assertTrue(); 221 done(); 222 }); 223 }); 224 225 /** 226 * @tc.number contactsApi_query_contacts_test_800 227 * @tc.name Query contacts information 228 * @tc.desc Function test 229 */ 230 it("contactsApi_query_contacts_test_800", 0, async function(done) { 231 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 232 contactsapi.queryContacts(holder, (data) => { 233 console.info("contactsApi_query_contacts_test_800 : query resultSet = " + JSON.stringify(data)); 234 expect(data != null).assertTrue(); 235 done(); 236 }); 237 }); 238 239 /** 240 * @tc.number contactsApi_query_contacts_test_900 241 * @tc.name Query contacts information 242 * @tc.desc Function test 243 */ 244 it("contactsApi_query_contacts_test_900", 0, async function(done) { 245 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 246 247 contactsapi.queryContacts(ContactAttributes, (data) => { 248 console.info("contactsApi_query_contacts_test_900 : query resultSet = " + JSON.stringify(data)); 249 expect(data != null).assertTrue(); 250 done(); 251 }); 252 }); 253 254 /** 255 * @tc.number contactsApi_query_contacts_test_1000 256 * @tc.name Query contacts information 257 * @tc.desc Function test 258 */ 259 it("contactsApi_query_contacts_test_1000", 0, async function(done) { 260 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 261 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 262 263 contactsapi.queryContacts(holder, ContactAttributes, (data) => { 264 console.info("contactsApi_query_contacts_test_1000 : query resultSet = " + JSON.stringify(data)); 265 expect(data != null).assertTrue(); 266 done(); 267 }); 268 }); 269 270 /** 271 * @tc.number contactsApi_query_email_test_1100 272 * @tc.name Query email information 273 * @tc.desc Function test 274 */ 275 it("contactsApi_query_email_test_1100", 0, async function(done) { 276 var email = "email"; 277 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 278 279 contactsapi.queryContactsByEmail(email, holder, (data) => { 280 console.info("contactsApi_query_email_test_1100 : query resultSet = " + JSON.stringify(data)); 281 expect(data != null).assertTrue(); 282 done(); 283 }); 284 }); 285 286 /** 287 * @tc.number contactsApi_query_email_test_1200 288 * @tc.name Query email information 289 * @tc.desc Function test 290 */ 291 it("contactsApi_query_email_test_1200", 0, async function(done) { 292 var email = "email"; 293 contactsapi.queryContactsByEmail(email, (data) => { 294 console.info("contactsApi_query_email_test_1200 : query resultSet = " + JSON.stringify(data)); 295 expect(data != null).assertTrue(); 296 done(); 297 }); 298 }); 299 300 /** 301 * @tc.number contactsApi_query_email_test_1300 302 * @tc.name Query email information 303 * @tc.desc Function test 304 */ 305 it("contactsApi_query_email_test_1300", 0, async function(done) { 306 var email = "email"; 307 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 308 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 309 310 contactsapi.queryContactsByEmail(email, holder, ContactAttributes, (data) => { 311 console.info("contactsApi_query_email_test_1300 : query resultSet = " + JSON.stringify(data)); 312 expect(data != null).assertTrue(); 313 done(); 314 }); 315 }); 316 317 /** 318 * @tc.number contactsApi_query_email_test_1400 319 * @tc.name Query email information 320 * @tc.desc Function test 321 */ 322 it("contactsApi_query_email_test_1400", 0, async function(done) { 323 var email = "email"; 324 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 325 326 contactsapi.queryContactsByEmail(email, ContactAttributes, (data) => { 327 console.info("contactsApi_query_email_test_1400 : query resultSet = " + JSON.stringify(data)); 328 expect(data != null).assertTrue(); 329 done(); 330 }); 331 }); 332 333 /** 334 * @tc.number contactsApi_query_phoneNumber_test_1500 335 * @tc.name Query phoneNumber information 336 * @tc.desc Function test 337 */ 338 it("contactsApi_query_phoneNumber_test_1500", 0, async function(done) { 339 var phoneNumber = "183"; 340 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 341 342 contactsapi.queryContactsByPhoneNumber(phoneNumber, holder, (data) => { 343 console.info("contactsApi_query_phoneNumber_test_1500 : query resultSet = " + JSON.stringify(data)); 344 expect(data != null).assertTrue(); 345 done(); 346 }); 347 }); 348 349 /** 350 * @tc.number contactsApi_query_phoneNumber_test_1600 351 * @tc.name Query phoneNumber information 352 * @tc.desc Function test 353 */ 354 it("contactsApi_query_phoneNumber_test_1600", 0, async function(done) { 355 var phoneNumber = "183"; 356 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 357 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 358 359 contactsapi.queryContactsByPhoneNumber(phoneNumber, holder, ContactAttributes, (data) => { 360 console.info("contactsApi_query_phoneNumber_test_1600 : query resultSet = " + JSON.stringify(data)); 361 expect(data != null).assertTrue(); 362 done(); 363 }); 364 }); 365 366 /** 367 * @tc.number contactsApi_query_phoneNumber_test_1700 368 * @tc.name Query phoneNumber information 369 * @tc.desc Function test 370 */ 371 it("contactsApi_query_phoneNumber_test_1700", 0, async function(done) { 372 var phoneNumber = "183"; 373 374 contactsapi.queryContactsByPhoneNumber(phoneNumber, (data) => { 375 console.info("contactsApi_query_phoneNumber_test_1700 : query resultSet = " + JSON.stringify(data)); 376 expect(data != null).assertTrue(); 377 done(); 378 }); 379 }); 380 381 /** 382 * @tc.number contactsApi_query_phoneNumber_test_1800 383 * @tc.name Query phoneNumber information 384 * @tc.desc Function test 385 */ 386 it("contactsApi_query_phoneNumber_test_1800", 0, async function(done) { 387 var phoneNumber = "183"; 388 var ContactAttributes = {attributes : [ 1, 5, 6 ]}; 389 390 contactsapi.queryContactsByPhoneNumber(phoneNumber, ContactAttributes, (data) => { 391 console.info("contactsApi_query_phoneNumber_test_1800 : query resultSet = " + JSON.stringify(data)); 392 expect(data != null).assertTrue(); 393 done(); 394 }); 395 }); 396 397 /** 398 * @tc.number contactsApi_query_group_test_1900 399 * @tc.name Query group 400 * @tc.desc Function test 401 */ 402 it("contactsApi_query_group_test_1900", 0, async function(done) { 403 contactsapi.queryGroups((data) => { 404 console.info("contactsApi_query_group_test_1900 : query resultSet = " + JSON.stringify(data)); 405 expect(data.length == 0).assertTrue(); 406 done(); 407 }); 408 }); 409 410 /** 411 * @tc.number contactsApi_query_group_test_2000 412 * @tc.name Query group 413 * @tc.desc Function test 414 */ 415 it("contactsApi_query_group_test_2000", 0, async function(done) { 416 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 417 418 contactsapi.queryGroups(holder, (data) => { 419 console.info("contactsApi_query_group_test_2000 : query resultSet = " + JSON.stringify(data)); 420 expect(data.length == 0).assertTrue(); 421 done(); 422 }); 423 }); 424 425 /** 426 * @tc.number contactsApi_query_holders_test_2200 427 * @tc.name Query holders information 428 * @tc.desc Function test 429 */ 430 it("contactsApi_query_holders_test_2200", 0, async function(done) { 431 contactsapi.queryHolders((data) => { 432 console.info("contactsApi_query_holders_test_2200 : query resultSet = " + JSON.stringify(data)); 433 expect(data != null).assertTrue(); 434 done(); 435 }); 436 }); 437 438 /** 439 * @tc.number contactsApi_query_key_test_2300 440 * @tc.name Query key information 441 * @tc.desc Function test 442 */ 443 it("contactsApi_query_key_test_2300", 0, async function(done) { 444 var idtest = g_rawContactId; 445 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 446 447 contactsapi.queryKey(idtest, holder, (data) => { 448 console.info("contactsApi_query_key_test_2300 : query resultSet = " + JSON.stringify(data)); 449 expect(data.length != 0).assertTrue(); 450 done(); 451 }); 452 }); 453 454 /** 455 * @tc.number contactsApi_query_key_test_2400 456 * @tc.name Query key information 457 * @tc.desc Function test 458 */ 459 it("contactsApi_query_key_test_2400", 0, async function(done) { 460 var idtest = g_rawContactId; 461 console.info("contactsApi_query_key_test_2400 : query g_rawContactId = " + idtest); 462 463 contactsapi.queryKey(idtest, (data) => { 464 console.info("contactsApi_query_key_test_2400 : query resultSet = " + JSON.stringify(data)); 465 expect(data.length != 0).assertTrue(); 466 done(); 467 }); 468 }); 469 470 /** 471 * @tc.number contactsApi_query_mycard_test_2500 472 * @tc.name Query mycard information 473 * @tc.desc Function test 474 */ 475 it("contactsApi_query_mycard_test_2500", 0, async function(done) { 476 var holder = {bundleName : "com.ohos.contacts", displayName : "phone", holderId : 1}; 477 478 contactsapi.queryMyCard(holder, (data) => { 479 console.info("contactsApi_query_mycard_test_2500 : query resultSet = " + JSON.stringify(data)); 480 expect(data.length == 0).assertTrue(); 481 done(); 482 }); 483 }); 484 485 /** 486 * @tc.number contactsApi_query_mycard_test_4000 487 * @tc.name Query mycard information 488 * @tc.desc Function test 489 */ 490 it("contactsApi_query_mycard_test_4000", 0, async function(done) { 491 contactsapi.queryMyCard((data) => { 492 console.info("contactsApi_query_mycard_test_4000 : query resultSet = " + JSON.stringify(data)); 493 expect(data.length == 0).assertTrue(); 494 done(); 495 }); 496 }); 497 498 /** 499 * @tc.number contactsApi_isMyCard_test_2600 500 * @tc.name Query mycard exist 501 * @tc.desc Function test 502 */ 503 it("contactsApi_isMyCard_test_2600", 0, async function(done) { 504 var id = 1; 505 506 contactsapi.isMyCard(id, (data) => { 507 console.info("contactsApi_isMyCard_test_2600 : query isExist = " + data); 508 expect(data == 0).assertTrue(); 509 done(); 510 }); 511 }); 512 513 /** 514 * @tc.number contactsApi_isLocalContact_test_2700 515 * @tc.name Query isLocalContact exist 516 * @tc.desc Function test 517 */ 518 it("contactsApi_isLocalContact_test_2700", 0, async function(done) { 519 var id = g_rawContactId; 520 521 contactsapi.isLocalContact(id, (data) => { 522 console.info("logMessage contactsApi_isLocalContact_test_2700 isExist = " + data); 523 expect(data == 1).assertTrue(); 524 done(); 525 }); 526 }); 527 528 /** 529 * @tc.number abnormal_contactsApi_insert_test_2800 530 * @tc.name contactsApi_insert error 531 * @tc.desc Function test 532 */ 533 it("abnormal_contactsApi_insert_test_2800", 0, async function(done) { 534 var contactDataError = {}; 535 536 contactsapi.addContact(contactDataError, (data) => { 537 console.info("abnormal_contactsApi_insert_test_2800 : rawContactId = " + data); 538 expect(data == -1).assertTrue(); 539 done(); 540 }); 541 }); 542 543 /** 544 * @tc.number abnormal_contactsApi_update_test_3000 545 * @tc.name contactsApi_update error 546 * @tc.desc Function test 547 */ 548 it("abnormal_contactsApi_update_test_3000", 0, async function(done) { 549 var rawContactId = -1; 550 var updateValues = {id : rawContactId, name : {fullName : "小红"}}; 551 var condition = {attributes : [ 6 ]}; 552 553 contactsapi.updateContact(updateValues, condition, (data) => { 554 console.info("abnormal_contactsApi_update_test_3000 : updateCode = " + data); 555 expect(data == -1).assertTrue(); 556 done(); 557 }); 558 }); 559 560 /** 561 * @tc.number abnormal_contactsApi_query_contact_test_3100 562 * @tc.name contactsApi_query_contact error 563 * @tc.desc Function test 564 */ 565 it("abnormal_contactsApi_query_contact_test_3100", 0, async function(done) { 566 var queryId = "-1"; 567 568 contactsapi.queryContact(queryId, (data) => { 569 if (data == null) { 570 console.info("abnormal_contactsApi_query_contact_test_3100 is null"); 571 } 572 if (data == undefined) { 573 console.info("abnormal_contactsApi_query_contact_test_3100 is undefined"); 574 } 575 console.info("abnormal_contactsApi_query_contact_test_3100 : updateCode = " + JSON.stringify(data)); 576 expect(data == undefined).assertTrue(); 577 done(); 578 }); 579 }); 580 581 /** 582 * @tc.number abnormal_contactsApi_query_contacts_test_3200 583 * @tc.name contactsApi_query_contacts error 584 * @tc.desc Function test 585 */ 586 it("abnormal_contactsApi_query_contacts_test_3200", 0, async function(done) { 587 var ContactAttributes = {attributes : [ 100 ]}; 588 589 contactsapi.queryContacts(ContactAttributes, (data) => { 590 if (data == null) { 591 console.info("abnormal_contactsApi_query_contacts_test_3200 is null"); 592 return; 593 } 594 console.info("abnormal_contactsApi_query_contacts_test_3200 : query resultSet = " + JSON.stringify(data)); 595 expect(data.length == 0).assertTrue(); 596 done(); 597 }); 598 }); 599 600 /** 601 * @tc.number abnormal_contactsApi_query_email_test_3300 602 * @tc.name contactsApi_query_email error 603 * @tc.desc Function test 604 */ 605 it("abnormal_contactsApi_query_email_test_3300", 0, async function(done) { 606 var email = "email2222"; 607 608 contactsapi.queryContactsByEmail(email, (data) => { 609 console.info("abnormal_contactsApi_query_email_test_3300 : query resultSet = " + JSON.stringify(data)); 610 expect(data.length == 0).assertTrue(); 611 done(); 612 }); 613 }); 614 615 /** 616 * @tc.number abnormal_contactsApi_query_phoneNumber_test_3400 617 * @tc.name contactsApi_query_phoneNumber error 618 * @tc.desc Function test 619 */ 620 it("abnormal_contactsApi_query_phoneNumber_test_3400", 0, async function(done) { 621 var phoneNumber = "19999999"; 622 623 contactsapi.queryContactsByPhoneNumber(phoneNumber, (data) => { 624 console.info( 625 "abnormal_contactsApi_query_phoneNumber_test_3400 : query resultSet = " + JSON.stringify(data)); 626 expect(data.length == 0).assertTrue(); 627 done(); 628 }); 629 }); 630 631 /** 632 * @tc.number abnormal_contactsApi_query_group_test_3500 633 * @tc.name contactsApi_query_group error 634 * @tc.desc Function test 635 */ 636 it("abnormal_contactsApi_query_group_test_3500", 0, async function(done) { 637 var holder = {bundleName : "com.ohos.contacts2", displayName : "phone2", holderId : 2}; 638 639 contactsapi.queryGroups(holder, (data) => { 640 console.info("abnormal_contactsApi_query_group_test_3500 : query resultSet = " + JSON.stringify(data)); 641 expect(data.length == 0).assertTrue(); 642 done(); 643 }); 644 }); 645 646 /** 647 * @tc.number abnormal_contactsApi_query_key_test_3600 648 * @tc.name contactsApi_query_key error 649 * @tc.desc Function test 650 */ 651 it("abnormal_contactsApi_query_key_test_3600", 0, async function(done) { 652 var idtest = -1; 653 654 contactsapi.queryKey(idtest, (data) => { 655 console.info("abnormal_contactsApi_query_key_test_3600 : query resultSet = " + JSON.stringify(data)); 656 expect(data.length == 0).assertTrue(); 657 done(); 658 }); 659 }); 660 661 /** 662 * @tc.number abnormal_contactsApi_query_mycard_test_3700 663 * @tc.name contactsApi_query_mycard error 664 * @tc.desc Function test 665 */ 666 it("abnormal_contactsApi_query_mycard_test_3700", 0, async function(done) { 667 var ContactAttributes = {attributes : [ 100 ]}; 668 669 contactsapi.queryMyCard(ContactAttributes, (data) => { 670 console.info("abnormal_contactsApi_query_mycard_test_3700 : query resultSet = " + JSON.stringify(data)); 671 expect(data.length == 0).assertTrue(); 672 done(); 673 }); 674 }); 675 676 /** 677 * @tc.number abnormal_contactsApi_isMyCard_test_3800 678 * @tc.name isMyCard is not exist 679 * @tc.desc Function test 680 */ 681 it("abnormal_contactsApi_isMyCard_test_3800", 0, async function(done) { 682 var id = 999; 683 684 contactsapi.isMyCard(id, (isExist) => { 685 console.info("abnormal_contactsApi_isMyCard_test_3800 : query isExist = " + isExist); 686 expect(isExist == 0).assertTrue(); 687 done(); 688 }); 689 }); 690 691 /** 692 * @tc.number abnormal_contactsApi_isLocalContact_test_3900 693 * @tc.name contactsApi_isLocalContact is not exist 694 * @tc.desc Function test 695 */ 696 it("abnormal_contactsApi_isLocalContact_test_3900", 0, async function(done) { 697 var id = 999; 698 699 contactsapi.isLocalContact(id, (isExist) => { 700 console.info("abnormal_contactsApi_isLocalContact_test_3900 : query isExist = " + isExist); 701 expect(isExist == 0).assertTrue(); 702 done(); 703 }); 704 }); 705 706});