1/* 2 * Copyright (c) 2021-2023 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 { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'deccjsunit/index'; 17 18const URI_CONTACTS = 'datashare:///com.ohos.contactsdataability'; 19const contactUri = 'datashare:///com.ohos.contactsdataability/contacts/contact'; 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 contactBlocklistUri = 'datashare:///com.ohos.contactsdataability/contacts/contact_blocklist'; 24const deletedRawContactUri = 'datashare:///com.ohos.contactsdataability/contacts/deleted_raw_contact'; 25const profileRawContactUri = 'datashare:///com.ohos.contactsdataability/profile/raw_contact'; 26const profilecontactUri = 'datashare:///com.ohos.contactsdataability/profile/contact'; 27const profileContactDataUri = 'datashare:///com.ohos.contactsdataability/profile/contact_data'; 28const profileGroupUri = 'datashare:///com.ohos.contactsdataability/profile/groups'; 29const profileBlocklistUri = 'datashare:///com.ohos.contactsdataability/profile/contact_blocklist'; 30const profileDeletedContactsUri = 'datashare:///com.ohos.contactsdataability/profile/deleted_raw_contact'; 31 32const URI_CALLLOG = 'datashare:///com.ohos.calllogability'; 33const calllogUri = 'datashare:///com.ohos.calllogability/calls/calllog'; 34const INDEX_TWO = 2; 35const INDEX_THREE = 3; 36const INDEX_FOUR = 4; 37const PHONE_NUM_LEN_SIX = 6; 38const PHONE_NUM_LEN_EIGHT = 8; 39 40export default { 41 data: {}, 42 getCallLogInsertMap: function () { 43 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 44 let calllogInsert100Map = new Map([ 45 ['phone_number', phoneNumber], 46 ['display_name', 'xxw'], 47 ['voicemail_uri', 'uri'], 48 ['sim_type', '1'], 49 ['is_hd', '2'], 50 ['is_read', '1'], 51 ['ring_duration', '900'], 52 ['talk_duration', '200'], 53 ['format_number', '123 456 789'], 54 ['quicksearch_key', '2'], 55 ['number_type', '2'], 56 ['number_type_name', 'tian'], 57 ['begin_time', '200'], 58 ['end_time', '300'], 59 ['answer_state', '1'], 60 ['create_time', '400'], 61 ['number_location', 'dizhi'], 62 ['photo_id', '1'], 63 ['photo_uri', '666'], 64 ['country_iso_code', '2'], 65 ['extra1', 'test1'], 66 ['extra2', 'test2'], 67 ['extra3', 'test3'], 68 ['extra4', 'test4'], 69 ['extra5', 'test5'], 70 ['extra6', 'test6'] 71 ]); 72 return calllogInsert100Map; 73 }, 74 getCallLogInsert: function () { 75 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 76 let calllogInsert100 = { 77 'phone_number': phoneNumber, 78 'display_name': 'xxw', 79 'voicemail_uri': 'uri', 80 'sim_type': 1, 81 'is_hd': 2, 82 'is_read': 1, 83 'ring_duration': 900, 84 'talk_duration': 200, 85 'format_number': '123 456 789', 86 'quicksearch_key': '2', 87 'number_type': 2, 88 'number_type_name': 'tian', 89 'begin_time': 200, 90 'end_time': 300, 91 'answer_state': 1, 92 'create_time': 400, 93 'number_location': 'dizhi', 94 'photo_id': 1, 95 'photo_uri': '666', 96 'country_iso_code': 2, 97 'extra1': 'test1', 98 'extra2': 'test2', 99 'extra3': 'test3', 100 'extra4': 'test4', 101 'extra5': 'test5', 102 'extra6': 'test6' 103 }; 104 return calllogInsert100; 105 }, 106 getCallLogResultColumns: function () { 107 let resultColumns = [ 108 'id', 109 'slot_id', 110 'phone_number', 111 'display_name', 112 'call_direction', 113 'voicemail_uri', 114 'sim_type', 115 'is_hd', 116 'is_read', 117 'ring_duration', 118 'talk_duration', 119 'format_number', 120 'quicksearch_key', 121 'number_type', 122 'number_type_name', 123 'begin_time', 124 'end_time', 125 'answer_state', 126 'create_time', 127 'number_location', 128 'photo_id', 129 'photo_uri', 130 'country_iso_code', 131 'extra1', 132 'extra2', 133 'extra3', 134 'extra4', 135 'extra5', 136 'extra6' 137 ]; 138 return resultColumns; 139 }, 140 getCallLogUpdate: function () { 141 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 142 let updateValues = { 143 'phone_number': phoneNumber, 144 'display_name': '6666', 145 'voicemail_uri': '7777', 146 'sim_type': 4, 147 'is_hd': 4, 148 'is_read': 4, 149 'ring_duration': 400, 150 'talk_duration': 400, 151 'format_number': '987 654 321', 152 'quicksearch_key': '4', 153 'number_type': 4, 154 'number_type_name': '4tian', 155 'begin_time': 400, 156 'end_time': 400, 157 'answer_state': 4, 158 'create_time': 40000, 159 'number_location': '4dizhi', 160 'photo_id': 4, 161 'photo_uri': '4444', 162 'country_iso_code': 4, 163 'extra1': 'test7', 164 'extra2': 'test7', 165 'extra3': 'test7', 166 'extra4': 'test7', 167 'extra5': 'test7', 168 'extra6': 'test7' 169 }; 170 return updateValues; 171 }, 172 getCallLogUpdateMap: function () { 173 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 174 let calllogInsert100Map = new Map([ 175 ['phone_number', phoneNumber], 176 ['display_name', '6666'], 177 ['voicemail_uri', '7777'], 178 ['sim_type', '4'], 179 ['is_hd', '4'], 180 ['is_read', '4'], 181 ['ring_duration', '400'], 182 ['talk_duration', '400'], 183 ['format_number', '987 654 321'], 184 ['quicksearch_key', '4'], 185 ['number_type', '4'], 186 ['number_type_name', '4tian'], 187 ['begin_time', '400'], 188 ['end_time', '400'], 189 ['answer_state', '4'], 190 ['create_time', '40000'], 191 ['number_location', '4dizhi'], 192 ['photo_id', '4'], 193 ['photo_uri', '4444'], 194 ['country_iso_code', '4'], 195 ['extra1', 'test7'], 196 ['extra2', 'test7'], 197 ['extra3', 'test7'], 198 ['extra4', 'test7'], 199 ['extra5', 'test7'], 200 ['extra6', 'test7'] 201 ]); 202 return calllogInsert100Map; 203 }, 204 getCallLogBatchInsert: function () { 205 let phoneNumberLenThree = 3; 206 let phoneNumber = randomNum(phoneNumberLenThree); 207 let map = new Map([ 208 ['phone_number', phoneNumber], 209 ['ring_duration', '333'] 210 ]); 211 let map2 = new Map([ 212 ['phone_number', phoneNumber], 213 ['ring_duration', '600'] 214 ]); 215 let map3 = new Map([ 216 ['phone_number', phoneNumber], 217 ['ring_duration', '600'] 218 ]); 219 let map4 = new Map([ 220 ['phone_number', phoneNumber], 221 ['ring_duration', '600'] 222 ]); 223 let map5 = new Map([ 224 ['phone_number', phoneNumber], 225 ['ring_duration', '600'] 226 ]); 227 let array = [map, map2, map3, map4, map5]; 228 return array; 229 }, 230 getProfileRawContact: function () { 231 let rawContact = { 232 'photo_id': 2, 233 'photo_file_id': 3, 234 'is_transfer_voicemail': 1, 235 'personal_ringtone': 'test', 236 'is_deleted': 0, 237 'personal_notification_ringtone': '666', 238 'photo_first_name': '7777', 239 'account_id': 1, 240 'version': 1, 241 'sort': '6666', 242 'contacted_count': 2, 243 'lastest_contacted_time': 2, 244 'favorite': 1, 245 'favorite_order': 1, 246 'phonetic_name': 'testname', 247 'phonetic_name_type': 1, 248 'display_name': 'licheng', 249 'company': 'TTTTT', 250 'position': 'Developer', 251 'read_only': 2, 252 'sort_first_letter': 'testsort', 253 'sync_id': 8, 254 'syn_1': 'syn_1', 255 'syn_2': 'syn_2', 256 'syn_3': 'syn_3' 257 }; 258 return rawContact; 259 }, 260 getProfileRawContactMap: function () { 261 let rawContactMap = new Map([ 262 ['photo_id', '2'], 263 ['photo_file_id', '3'], 264 ['is_transfer_voicemail', '1'], 265 ['personal_ringtone', 'test'], 266 ['is_deleted', '0'], 267 ['personal_notification_ringtone', '666'], 268 ['photo_first_name', '7777'], 269 ['account_id', '1'], 270 ['version', '1'], 271 ['sort', '6666'], 272 ['contacted_count', '2'], 273 ['lastest_contacted_time', '2'], 274 ['favorite', '1'], 275 ['favorite_order', '1'], 276 ['phonetic_name', 'testname'], 277 ['phonetic_name_type', '1'], 278 ['display_name', 'licheng'], 279 ['company', 'TTTTT'], 280 ['position', 'Developer'], 281 ['read_only', '2'], 282 ['sort_first_letter', 'testsort'], 283 ['merge_mode', '0'], 284 ['is_need_merge', '1'], 285 ['merge_status', '1'], 286 ['is_merge_target', '0'], 287 ['vibration_setting', '0'], 288 ['sync_id', '8'], 289 ['syn_1', 'syn_1'], 290 ['syn_2', 'syn_2'], 291 ['syn_3', 'syn_3'] 292 ]); 293 return rawContactMap; 294 }, 295 getProfileRawContactUpdate: function () { 296 let rawContact = { 297 'photo_id': 21, 298 'photo_file_id': 31, 299 'is_transfer_voicemail': 11, 300 'personal_ringtone': 'test1', 301 'is_deleted': 0, 302 'personal_notification_ringtone': '6661', 303 'photo_first_name': '77771', 304 'account_id': 1, 305 'sort': '66661', 306 'contacted_count': 21, 307 'lastest_contacted_time': 21, 308 'favorite': 11, 309 'favorite_order': 1, 310 'phonetic_name': 'testname1', 311 'phonetic_name_type': 11, 312 'display_name': 'licheng1', 313 'company': 'TTTTT1', 314 'position': 'Developer1', 315 'read_only': 21, 316 'sort_first_letter': 'testsort1', 317 'sync_id': 81, 318 'syn_1': 'syn_11', 319 'syn_2': 'syn_21', 320 'syn_3': 'syn_31' 321 }; 322 return rawContact; 323 }, 324 getProfileRawContactUpdateMap: function () { 325 let rawContactMap = new Map([ 326 ['photo_id', '21'], 327 ['photo_file_id', '31'], 328 ['is_transfer_voicemail', '11'], 329 ['personal_ringtone', 'test1'], 330 ['is_deleted', '0'], 331 ['personal_notification_ringtone', '6661'], 332 ['photo_first_name', '77771'], 333 ['account_id', '1'], 334 ['version', '1'], 335 ['sort', '66661'], 336 ['contacted_count', '21'], 337 ['lastest_contacted_time', '21'], 338 ['favorite', '11'], 339 ['favorite_order', '1'], 340 ['phonetic_name', 'testname1'], 341 ['phonetic_name_type', '11'], 342 ['display_name', 'licheng1'], 343 ['company', 'TTTTT1'], 344 ['position', 'Developer1'], 345 ['read_only', '21'], 346 ['sort_first_letter', 'testsort1'], 347 ['merge_mode', '0'], 348 ['is_need_merge', '1'], 349 ['merge_status', '1'], 350 ['is_merge_target', '0'], 351 ['vibration_setting', '0'], 352 ['sync_id', '81'], 353 ['syn_1', 'syn_11'], 354 ['syn_2', 'syn_21'], 355 ['syn_3', 'syn_31'] 356 ]); 357 return rawContactMap; 358 }, 359 getProfileContactData: function () { 360 let contactData = { 361 'content_type': 'name', 362 'detail_info': 'xiaocai', 363 'family_name': 'family_name', 364 'middle_name_phonetic': 'middle_name_phonetic', 365 'given_name': 'given_name', 366 'given_name_phonetic': 'given_name_phonetic', 367 'alias_detail_info': 'alias_detail_info', 368 'phonetic_name': 'phonetic_name', 369 'position': 'Developer', 370 'extend1': 'extend1', 371 'extend2': 'extend2', 372 'extend3': 'extend3', 373 'extend4': 'extend4', 374 'city': 'city', 375 'country': 'country', 376 'neighborhood': 'neighborhood', 377 'pobox': 'pobox', 378 'postcode': 'postcode', 379 'region': 'region', 380 'street': 'street', 381 'alpha_name': 'alpha_name', 382 'other_lan_last_name': 'other_lan_last_name', 383 'other_lan_first_name': 'other_lan_first_name', 384 'extend5': 'extend5', 385 'lan_style': 'lan_style', 386 'custom_data': 'custom_data', 387 'extend6': 'extend6', 388 'extend7': 'extend7', 389 'blob_data': 'blob_data', 390 'syn_1': 'syn_1', 391 'syn_2': 'syn_2', 392 'syn_3': 'syn_3' 393 }; 394 return contactData; 395 }, 396 getProfileContactDataMap: function () { 397 let ContactDataMap = new Map([ 398 ['detail_info', 'xiaocai'], 399 ['family_name', 'family_name'], 400 ['middle_name_phonetic', 'middle_name_phonetic'], 401 ['given_name', 'given_name'], 402 ['given_name_phonetic', 'given_name_phonetic'], 403 ['alias_detail_info', 'alias_detail_info'], 404 ['phonetic_name', 'phonetic_name'], 405 ['position', 'position'], 406 ['extend1', 'extend1'], 407 ['extend2', 'extend2'], 408 ['pobox', 'pobox'], 409 ['postcode', 'postcode'], 410 ['city', 'city'], 411 ['country', 'country'], 412 ['neighborhood', 'neighborhood'], 413 ['position', 'Developer'], 414 ['region', 'region'], 415 ['street', 'street'], 416 ['alpha_name', 'alpha_name'], 417 ['other_lan_last_name', 'other_lan_last_name'], 418 ['other_lan_first_name', 'other_lan_first_name'], 419 ['extend5', 'extend5'], 420 ['lan_style', 'lan_style'], 421 ['custom_data', 'custom_data'], 422 ['extend6', 'extend6'], 423 ['extend7', 'extend7'], 424 ['blob_data', 'blob_data'], 425 ['syn_1', 'syn_1'], 426 ['syn_2', 'syn_2'], 427 ['syn_3', 'syn_3'], 428 ['read_only', '0'], 429 ['version', '0'], 430 ['is_preferred_number', '0'] 431 ]); 432 return ContactDataMap; 433 }, 434 getProfileContactDataUpdate: function () { 435 let contactData = { 436 'detail_info': 'xiaocai1', 437 'family_name': 'family_name1', 438 'middle_name_phonetic': 'middle_name_phonetic1', 439 'given_name': 'given_name1', 440 'given_name_phonetic': 'given_name_phonetic1', 441 'alias_detail_info': 'alias_detail_info1', 442 'phonetic_name': 'phonetic_name1', 443 'position': 'Developer1', 444 'extend1': 'extend11', 445 'extend2': 'extend21', 446 'extend3': 'extend31', 447 'extend4': 'extend41', 448 'city': 'city1', 449 'country': 'country1', 450 'neighborhood': 'neighborhood1', 451 'pobox': 'pobox1', 452 'postcode': 'postcode1', 453 'region': 'region1', 454 'street': 'street1', 455 'alpha_name': 'alpha_name1', 456 'other_lan_last_name': 'other_lan_last_name1', 457 'other_lan_first_name': 'other_lan_first_name1', 458 'extend5': 'extend51', 459 'lan_style': 'lan_style1', 460 'custom_data': 'custom_data1', 461 'extend6': 'extend61', 462 'extend7': 'extend71', 463 'blob_data': 'blob_data1', 464 'syn_1': 'syn_11', 465 'syn_2': 'syn_21', 466 'syn_3': 'syn_31' 467 }; 468 return contactData; 469 }, 470 getProfileContactDataUpdateMap: function () { 471 let ContactDataMap = new Map([ 472 ['detail_info', 'xiaocai1'], 473 ['family_name', 'family_name1'], 474 ['middle_name_phonetic', 'middle_name_phonetic1'], 475 ['given_name', 'given_name1'], 476 ['given_name_phonetic', 'given_name_phonetic1'], 477 ['alias_detail_info', 'alias_detail_info1'], 478 ['phonetic_name', 'phonetic_name1'], 479 ['position', 'position1'], 480 ['extend1', 'extend11'], 481 ['extend2', 'extend21'], 482 ['pobox', 'pobox1'], 483 ['postcode', 'postcode1'], 484 ['city', 'city1'], 485 ['country', 'country1'], 486 ['neighborhood', 'neighborhood1'], 487 ['position', 'Developer1'], 488 ['region', 'region1'], 489 ['street', 'street1'], 490 ['alpha_name', 'alpha_name1'], 491 ['other_lan_last_name', 'other_lan_last_name1'], 492 ['other_lan_first_name', 'other_lan_first_name1'], 493 ['extend5', 'extend51'], 494 ['lan_style', 'lan_style1'], 495 ['custom_data', 'custom_data1'], 496 ['extend6', 'extend61'], 497 ['extend7', 'extend71'], 498 ['blob_data', 'blob_data1'], 499 ['syn_1', 'syn_11'], 500 ['syn_2', 'syn_21'], 501 ['syn_3', 'syn_31'], 502 ['read_only', '0'], 503 ['version', '1'], 504 ['is_preferred_number', '0'] 505 ]); 506 return ContactDataMap; 507 }, 508 getProfileGroup: function () { 509 let group = { 510 'account_id': 1, 511 'group_name': 'DeveloperFirsthGroup', 512 'group_notes': 'note', 513 'group_ringtone': 'test' 514 }; 515 return group; 516 }, 517 getProfileGroupMap: function () { 518 let groupMap = new Map([ 519 ['account_id', '1'], 520 ['group_name', 'DeveloperFirsthGroup'], 521 ['group_notes', 'note'], 522 ['is_deleted', '0'], 523 ['group_ringtone', 'test'], 524 ['ringtone_modify_time', '0'], 525 ['lastest_modify_time', '0'] 526 ]); 527 return groupMap; 528 }, 529 getProfileBlockList: function () { 530 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 531 let blockList = { 'phone_number': phoneNumber, 'content': 'heimingdan' }; 532 return blockList; 533 }, 534 getProfileBlockListMap: function () { 535 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 536 let blockListMap = new Map([ 537 ['types', '0'], 538 ['phone_number', phoneNumber], 539 ['content', 'heimingdan'], 540 ['time_stamp', '0'] 541 ]); 542 return blockListMap; 543 }, 544 getProfileUpdateRawContact: function () { 545 let rawContact = { 546 'photo_id': 8, 547 'photo_file_id': 8, 548 'is_transfer_voicemail': 8, 549 'personal_ringtone': 'test8', 550 'is_deleted': 1, 551 'personal_notification_ringtone': '888', 552 'photo_first_name': '9999', 553 'account_id': 8, 554 'version': 2, 555 'sort': '8888', 556 'contacted_count': 8, 557 'lastest_contacted_time': 8, 558 'favorite': 0, 559 'favorite_order': 1, 560 'phonetic_name': 'testname8', 561 'phonetic_name_type': 8, 562 'display_name': 'licheng8', 563 'company': 'TTTTT8', 564 'position': 'Developer8', 565 'read_only': 8, 566 'sort_first_letter': 'testsort8', 567 'sync_id': 888, 568 'syn_1': 'syn_8', 569 'syn_2': 'syn_8', 570 'syn_3': 'syn_8' 571 }; 572 return rawContact; 573 }, 574 getProfileUpdateRawContactMap: function () { 575 let rawContactMap = new Map([ 576 ['photo_id', '8'], 577 ['photo_file_id', '8'], 578 ['is_transfer_voicemail', '8'], 579 ['personal_ringtone', 'test8'], 580 ['is_deleted', '1'], 581 ['personal_notification_ringtone', '888'], 582 ['photo_first_name', '9999'], 583 ['account_id', '8'], 584 ['version', '2'], 585 ['sort', '8888'], 586 ['contacted_count', '8'], 587 ['lastest_contacted_time', '8'], 588 ['favorite', '0'], 589 ['favorite_order', '1'], 590 ['phonetic_name', 'testname8'], 591 ['phonetic_name_type', '8'], 592 ['display_name', 'licheng8'], 593 ['company', 'TTTTT8'], 594 ['position', 'Developer8'], 595 ['read_only', '8'], 596 ['sort_first_letter', 'testsort8'], 597 ['merge_mode', '0'], 598 ['is_need_merge', '1'], 599 ['merge_status', '1'], 600 ['is_merge_target', '0'], 601 ['vibration_setting', '0'], 602 ['sync_id', '888'], 603 ['syn_1', 'syn_8'], 604 ['syn_2', 'syn_8'], 605 ['syn_3', 'syn_8'] 606 ]); 607 return rawContactMap; 608 }, 609 getProfileUpdateContactData: function () { 610 let contactData = { 611 'detail_info': 'BossCai', 612 'family_name': 'family_name8', 613 'middle_name_phonetic': 'middle_name_phonetic8', 614 'given_name': 'given_name8', 615 'given_name_phonetic': 'given_name_phonetic8', 616 'alias_detail_info': 'alias_detail_info8', 617 'phonetic_name': 'phonetic_name8', 618 'position': 'position8', 619 'extend1': 'extend8', 620 'extend2': 'extend8', 621 'extend3': 'extend8', 622 'extend4': 'extend8', 623 'country': 'country8', 624 'neighborhood': 'neighborhood8', 625 'pobox': 'pobox8', 626 'city': 'city8', 627 'postcode': 'postcode8', 628 'region': 'region8', 629 'street': 'street8', 630 'alpha_name': 'alpha_name8', 631 'other_lan_last_name': 'other_lan_last_name8', 632 'other_lan_first_name': 'other_lan_first_name8', 633 'extend5': 'extend8', 634 'lan_style': 'lan_style8', 635 'custom_data': 'custom_data8', 636 'extend6': 'extend8', 637 'extend7': 'extend8', 638 'blob_data': 'blob_data8', 639 'syn_1': 'syn_8', 640 'syn_2': 'syn_8', 641 'syn_3': 'syn_8' 642 }; 643 return contactData; 644 }, 645 getProfileUpdateContactDataMap: function () { 646 let ContactDataMap = new Map([ 647 ['detail_info', 'BossCai'], 648 ['family_name', 'family_name8'], 649 ['middle_name_phonetic', 'middle_name_phonetic8'], 650 ['given_name', 'given_name8'], 651 ['given_name_phonetic', 'given_name_phonetic8'], 652 ['alias_detail_info', 'alias_detail_info8'], 653 ['phonetic_name', 'phonetic_name8'], 654 ['position', 'position8'], 655 ['extend1', 'extend8'], 656 ['extend2', 'extend8'], 657 ['pobox', 'pobox8'], 658 ['postcode', 'postcode8'], 659 ['city', 'city8'], 660 ['country', 'country8'], 661 ['neighborhood', 'neighborhood8'], 662 ['position', 'position8'], 663 ['region', 'region8'], 664 ['street', 'street8'], 665 ['alpha_name', 'alpha_name8'], 666 ['other_lan_last_name', 'other_lan_last_name8'], 667 ['other_lan_first_name', 'other_lan_first_name8'], 668 ['extend5', 'extend8'], 669 ['lan_style', 'lan_style8'], 670 ['custom_data', 'custom_data8'], 671 ['extend6', 'extend8'], 672 ['extend7', 'extend8'], 673 ['blob_data', 'blob_data8'], 674 ['syn_1', 'syn_8'], 675 ['syn_2', 'syn_8'], 676 ['syn_3', 'syn_8'], 677 ['read_only', '0'], 678 ['version', '1'], 679 ['is_preferred_number', '0'] 680 ]); 681 return ContactDataMap; 682 }, 683 getProfileUpdateGroup: function () { 684 let group = { 685 'account_id': 8, 686 'group_name': 'TestFifthGroup', 687 'group_notes': 'note8', 688 'group_ringtone': 'test8' 689 }; 690 return group; 691 }, 692 getProfileUpdateGroupMap: function () { 693 let groupMap = new Map([ 694 ['account_id', '8'], 695 ['group_name', 'TestFifthGroup'], 696 ['group_notes', 'note8'], 697 ['is_deleted', '0'], 698 ['group_ringtone', 'test8'], 699 ['ringtone_modify_time', '0'], 700 ['lastest_modify_time', '0'] 701 ]); 702 return groupMap; 703 }, 704 getProfileUpdateBlockList: function () { 705 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 706 let blockList = { 707 'phone_number': phoneNumber, 708 'content': 'danminghei' 709 }; 710 return blockList; 711 }, 712 getProfileUpdateBlockListMap: function () { 713 let phoneNumber = randomNum(PHONE_NUM_LEN_EIGHT); 714 let blockListMap = new Map([ 715 ['types', '0'], 716 ['phone_number', phoneNumber], 717 ['content', 'danminghei'], 718 ['time_stamp', '0'] 719 ]); 720 return blockListMap; 721 }, 722 getVoiceMail: function () { 723 let phoneNumberLenFour = 4; 724 let phoneNumber = randomNum(phoneNumberLenFour); 725 let voicemail = { 726 'phone_number': phoneNumber, 727 'quicksearch_key': '777', 728 'display_name': 'xiaoli', 729 'voicemail_uri': 'XXXX', 730 'origin_type': 'xxxxx', 731 'create_time': 0 732 }; 733 return voicemail; 734 }, 735 getVoiceMailMap: function () { 736 let phoneNumberLenFour = 4; 737 let phoneNumber = randomNum(phoneNumberLenFour); 738 let map = new Map([ 739 ['phone_number', phoneNumber], 740 ['quicksearch_key', '777'], 741 ['display_name', 'xiaoli'], 742 ['voicemail_uri', 'XXXX'], 743 ['origin_type', 'xxxxx'], 744 ['create_time', '0'], 745 ['voicemail_type', '0'], 746 ['voice_file_size', '0'], 747 ['voice_duration', '0'], 748 ['voice_status', '0'] 749 ]); 750 return map; 751 }, 752 getVoiceMailUpdate: function () { 753 let phoneNumber = randomNum(PHONE_NUM_LEN_SIX); 754 let voicemail = { 755 'phone_number': phoneNumber, 756 'quicksearch_key': '999', 757 'display_name': 'xiaocai', 758 'voicemail_uri': 'uuuu', 759 'origin_type': 'iiiii', 760 'create_time': '999' 761 }; 762 return voicemail; 763 }, 764 getVoiceMailUpdateMap: function () { 765 let phoneNumber = randomNum(PHONE_NUM_LEN_SIX); 766 let map = new Map([ 767 ['phone_number', phoneNumber], 768 ['quicksearch_key', '999'], 769 ['display_name', 'xiaocai'], 770 ['voicemail_uri', 'uuuu'], 771 ['origin_type', 'iiiii'], 772 ['create_time', '999'], 773 ['voicemail_type', '0'], 774 ['voice_file_size', '0'], 775 ['voice_duration', '0'], 776 ['voice_status', '0'] 777 ]); 778 return map; 779 }, 780 getVoiceMailBatchInsert: function () { 781 let phoneNumberLenThree = 3; 782 let phoneNumber = randomNum(phoneNumberLenThree); 783 let map = new Map([ 784 ['phone_number', phoneNumber], 785 ['display_name', 'xiaoming'], 786 ['voice_status', '0'] 787 ]); 788 let map2 = new Map([ 789 ['phone_number', phoneNumber], 790 ['display_name', 'xiaohei'], 791 ['voice_status', '1'] 792 ]); 793 let map3 = new Map([ 794 ['phone_number', phoneNumber], 795 ['display_name', 'xiaohong'], 796 ['voice_status', '0'] 797 ]); 798 let map4 = new Map([ 799 ['phone_number', phoneNumber], 800 ['display_name', 'xiaohei'], 801 ['voice_status', '0'] 802 ]); 803 let map5 = new Map([ 804 ['phone_number', phoneNumber], 805 ['display_name', 'xiaofen'], 806 ['voice_status', '0'] 807 ]); 808 let array = [map, map2, map3, map4, map5]; 809 return array; 810 }, 811 getContactBatchCompany: function () { 812 let rawContactValuesOne = { 'display_name': 'fengyuanyuan', 'company': 'TT4900', 'position': 'Testers' }; 813 let rawContactValuesTwo = { 'display_name': 'caiboss', 'company': 'TT4900', 'position': 'developer' }; 814 let rawContactValuesThree = { 'display_name': 'zhangsan', 'company': 'TT4900', 'position': 'developer' }; 815 let rawContactValuesFour = { 'display_name': 'lisi', 'company': 'TT4900', 'position': 'developer' }; 816 let rawContactValuesFive = { 'display_name': 'wangwu', 'company': 'TT4900', 'position': 'developer' }; 817 let listAddBluk = []; 818 listAddBluk[0] = rawContactValuesOne; 819 listAddBluk[1] = rawContactValuesTwo; 820 listAddBluk[INDEX_TWO] = rawContactValuesThree; 821 listAddBluk[INDEX_THREE] = rawContactValuesFour; 822 listAddBluk[INDEX_FOUR] = rawContactValuesFive; 823 return listAddBluk; 824 }, 825 getContactBatchCompanyTwo: function () { 826 let contactDataValuesOne = { 827 'raw_contact_id': rawContactId, 828 'content_type': 'name', 829 'detail_info': 'xiaozhi' 830 }; 831 let contactDataValuesTwo = { 832 'raw_contact_id': rawContactId, 833 'content_type': 'organization', 834 'detail_info': 'TT', 835 'position': 'Testers' 836 }; 837 let contactDataValuesThree = { 838 'raw_contact_id': rawContactId, 839 'content_type': 'email', 840 'detail_info': '15844@163.com' 841 }; 842 let contactDataValuesFour = { 843 'raw_contact_id': rawContactId, 844 'content_type': 'nickname', 845 'detail_info': 'xiaozhicheng' 846 }; 847 let contactDataValuesFive = { 848 'raw_contact_id': rawContactId, 849 'content_type': 'phone', 850 'detail_info': '111885566' 851 }; 852 let listAddBluk = []; 853 listAddBluk[0] = contactDataValuesOne; 854 listAddBluk[1] = contactDataValuesTwo; 855 listAddBluk[INDEX_TWO] = contactDataValuesThree; 856 listAddBluk[INDEX_THREE] = contactDataValuesFour; 857 listAddBluk[INDEX_FOUR] = contactDataValuesFive; 858 return listAddBluk; 859 }, 860 getPhoneNumberBatch: function () { 861 let phoneNumberLenThirteen = 13; 862 let phoneNumber = randomNum(phoneNumberLenThirteen); 863 let contactBlocklistValuesOne = { 'phone_number': phoneNumber }; 864 let contactBlocklistValuesTwo = { 'phone_number': phoneNumber }; 865 let contactBlocklistValuesThree = { 'phone_number': phoneNumber }; 866 let contactBlocklistValuesFour = { 'phone_number': phoneNumber }; 867 let contactBlocklistValuesFive = { 'phone_number': phoneNumber }; 868 let listAddBluk = []; 869 listAddBluk[0] = contactBlocklistValuesOne; 870 listAddBluk[1] = contactBlocklistValuesTwo; 871 listAddBluk[INDEX_TWO] = contactBlocklistValuesThree; 872 listAddBluk[INDEX_THREE] = contactBlocklistValuesFour; 873 listAddBluk[INDEX_FOUR] = contactBlocklistValuesFive; 874 return listAddBluk; 875 }, 876 getSearchMap: function () { 877 let map = new Map([ 878 ['account_id', '1'], 879 ['search_name', '小黄||xiaohuang||xh'], 880 ['display_name', '小黄'], 881 ['phonetic_name', ''], 882 ['photo_id', ''], 883 ['photo_file_id', ''] 884 ]); 885 return map; 886 } 887}; 888 889function randomNum(num) { 890 let baseNumNine = 9; 891 let baseNumTen = 10; 892 let number = toString(Math.floor(Math.random() * (baseNumNine * Math.pow(baseNumTen, num))) + 1 * 893 Math.pow(baseNumTen, num)); 894 return number; 895} 896