import { QuestionReferenceType } from "@boldpenguin/sdk-types";
import { newSpecPage } from "@stencil/core/testing";
import { BpSdkAddressGroup } from "./bp-sdk-address-group";
const answers = [
    {
        id: '59a1b67b-8a33-4368-99c2-806469f81ca7',
        value: '500 Boylston St',
        choice_id: null,
        choice_ids: [],
        active: true,
        version: 6,
        display_type: 'public',
        application_form_id: 'c9e2496a-4471-4895-a89c-cf1a8328c429',
        is_completed: true,
        created_at: '2020-01-14T10:40:19.216-05:00',
        updated_at: '2020-01-14T15:36:42.374-05:00',
        question: {
            id: '557220b3-5b7b-40ab-9f7f-21f248a18ff7',
            code: 'business_coverage_address_1',
            text: 'Physical address',
            error_text: null,
            help_text: null,
            order: 6,
            question_set_id: '090e27f1-9c5f-4941-a036-d41574ae7330',
            field_type: 'text',
            multiple: false,
            autocomplete: false,
            min_value: null,
            max_value: null,
            min_date: null,
            max_date: null,
            pattern: '',
            is_hidden: false,
            is_active: false,
            is_sensitive: false,
            required: true,
            trackable: false,
            created_at: '2019-12-17T16:42:31.670-05:00',
            updated_at: '2019-12-17T16:42:31.975-05:00',
            question_group_id: 'd887ab1b-084d-4824-86b3-25a6b9efc8e6',
            reference_type: 'street_1',
            placeholder: null,
            choices: [],
        },
    },
    {
        id: 'd65dfc30-94b6-444f-b14b-d0fa80f29fbe',
        value: null,
        choice_id: null,
        choice_ids: [],
        active: true,
        version: 2,
        display_type: 'public',
        application_form_id: 'c9e2496a-4471-4895-a89c-cf1a8328c429',
        is_completed: true,
        created_at: '2020-01-14T10:40:19.228-05:00',
        updated_at: '2020-01-14T10:40:19.228-05:00',
        question: {
            id: '0deebce9-b44b-4896-a33b-2dc5b9ee8f6c',
            code: 'business_coverage_address_2',
            text: 'Suite / Apt Number',
            error_text: null,
            help_text: null,
            order: 7,
            question_set_id: '090e27f1-9c5f-4941-a036-d41574ae7330',
            field_type: 'text',
            multiple: false,
            autocomplete: false,
            min_value: null,
            max_value: null,
            min_date: null,
            max_date: null,
            pattern: '',
            is_hidden: false,
            is_active: false,
            is_sensitive: false,
            required: false,
            trackable: false,
            created_at: '2019-12-17T16:42:31.694-05:00',
            updated_at: '2019-12-17T16:42:31.978-05:00',
            question_group_id: 'd887ab1b-084d-4824-86b3-25a6b9efc8e6',
            reference_type: 'street_2',
            placeholder: null,
            choices: [],
        },
    },
    {
        id: 'a233e24f-1b16-4143-abe3-e595edc558fc',
        value: 'Boston',
        choice_id: null,
        choice_ids: [],
        active: true,
        version: 4,
        display_type: 'public',
        application_form_id: 'c9e2496a-4471-4895-a89c-cf1a8328c429',
        is_completed: true,
        created_at: '2020-01-14T10:40:19.471-05:00',
        updated_at: '2020-01-14T15:36:43.220-05:00',
        question: {
            id: '859106f0-ae49-40b0-9dfc-c2049bdc728e',
            code: 'business_coverage_city',
            text: 'City',
            error_text: null,
            help_text: null,
            order: 9,
            question_set_id: '090e27f1-9c5f-4941-a036-d41574ae7330',
            field_type: 'text',
            multiple: false,
            autocomplete: false,
            min_value: null,
            max_value: null,
            min_date: null,
            max_date: null,
            pattern: '',
            is_hidden: false,
            is_active: false,
            is_sensitive: false,
            required: true,
            trackable: false,
            created_at: '2019-12-17T16:42:31.741-05:00',
            updated_at: '2019-12-17T16:42:31.985-05:00',
            question_group_id: 'd887ab1b-084d-4824-86b3-25a6b9efc8e6',
            reference_type: 'city',
            placeholder: null,
            choices: [],
        },
    },
    {
        id: 'c321ba7b-e772-4e65-bbec-df2e83a07a05',
        value: null,
        choice_id: '38547e0a-075f-435e-9633-abfed3b3638c',
        choice_ids: [],
        active: true,
        version: 3,
        display_type: 'public',
        application_form_id: 'c9e2496a-4471-4895-a89c-cf1a8328c429',
        is_completed: true,
        created_at: '2020-01-14T10:40:19.491-05:00',
        updated_at: '2020-01-14T10:40:38.585-05:00',
        question: {
            id: '478b4411-8452-4130-9730-d09c81ed1578',
            code: 'business_coverage_state',
            text: 'State',
            error_text: null,
            help_text: null,
            order: 10,
            question_set_id: '090e27f1-9c5f-4941-a036-d41574ae7330',
            field_type: 'dropdown',
            multiple: false,
            autocomplete: false,
            min_value: null,
            max_value: null,
            min_date: null,
            max_date: null,
            pattern: '',
            is_hidden: false,
            is_active: false,
            is_sensitive: false,
            required: true,
            trackable: false,
            created_at: '2019-12-17T16:42:31.774-05:00',
            updated_at: '2019-12-17T16:42:31.988-05:00',
            question_group_id: 'd887ab1b-084d-4824-86b3-25a6b9efc8e6',
            reference_type: 'state',
            placeholder: null,
            choices: [
                {
                    id: 'd00c050f-9031-4307-9b82-8a7917a65acc',
                    value: 'Alaska',
                    alias: 'AK',
                    order: 0,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.776-05:00',
                    updated_at: '2019-12-17T16:42:31.776-05:00',
                },
                {
                    id: '2678c6de-60b6-42a8-8fc0-414809bc05d2',
                    value: 'Alabama',
                    alias: 'AL',
                    order: 1,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.779-05:00',
                    updated_at: '2019-12-17T16:42:31.779-05:00',
                },
                {
                    id: 'f8f0b0c2-b2a7-40ee-806c-82c1cca66d85',
                    value: 'Arkansas',
                    alias: 'AR',
                    order: 2,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.781-05:00',
                    updated_at: '2019-12-17T16:42:31.781-05:00',
                },
                {
                    id: '3c62cb0d-9394-442c-93dc-f49dad5873bc',
                    value: 'Arizona',
                    alias: 'AZ',
                    order: 3,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.783-05:00',
                    updated_at: '2019-12-17T16:42:31.783-05:00',
                },
                {
                    id: '4ee41620-aebe-4e03-bc86-8f0aa759bcea',
                    value: 'California',
                    alias: 'CA',
                    order: 4,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.785-05:00',
                    updated_at: '2019-12-17T16:42:31.785-05:00',
                },
                {
                    id: '1d9e5dc2-f844-45b3-babb-497cd67f3659',
                    value: 'Colorado',
                    alias: 'CO',
                    order: 5,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.787-05:00',
                    updated_at: '2019-12-17T16:42:31.787-05:00',
                },
                {
                    id: 'd38e651e-e283-4e89-8a55-e2b7fe89b0cc',
                    value: 'Connecticut',
                    alias: 'CT',
                    order: 6,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.789-05:00',
                    updated_at: '2019-12-17T16:42:31.789-05:00',
                },
                {
                    id: 'bc4f50cb-9c31-4b89-b05c-f3f3400ae046',
                    value: 'District of Columbia',
                    alias: 'DC',
                    order: 7,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.790-05:00',
                    updated_at: '2019-12-17T16:42:31.790-05:00',
                },
                {
                    id: '0a365fb3-8b7b-4938-a873-38837caf8323',
                    value: 'Delaware',
                    alias: 'DE',
                    order: 8,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.792-05:00',
                    updated_at: '2019-12-17T16:42:31.792-05:00',
                },
                {
                    id: '68bb5da7-9cf8-4aeb-948a-43511e631031',
                    value: 'Florida',
                    alias: 'FL',
                    order: 9,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.794-05:00',
                    updated_at: '2019-12-17T16:42:31.794-05:00',
                },
                {
                    id: '8a06ed31-6f8a-4c43-8491-e843b72ff846',
                    value: 'Georgia',
                    alias: 'GA',
                    order: 10,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.796-05:00',
                    updated_at: '2019-12-17T16:42:31.796-05:00',
                },
                {
                    id: '88e4283b-a3aa-41cc-95d8-817ed2f135e2',
                    value: 'Hawaii',
                    alias: 'HI',
                    order: 11,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.797-05:00',
                    updated_at: '2019-12-17T16:42:31.797-05:00',
                },
                {
                    id: '1e82bbf1-f9d5-47ec-b334-84e1edd371c4',
                    value: 'Iowa',
                    alias: 'IA',
                    order: 12,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.799-05:00',
                    updated_at: '2019-12-17T16:42:31.799-05:00',
                },
                {
                    id: '319ad97b-b836-454a-b448-576ebff82af9',
                    value: 'Idaho',
                    alias: 'ID',
                    order: 13,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.801-05:00',
                    updated_at: '2019-12-17T16:42:31.801-05:00',
                },
                {
                    id: '2970aa76-c688-4ee9-b809-68418eae830e',
                    value: 'Illinois',
                    alias: 'IL',
                    order: 14,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.802-05:00',
                    updated_at: '2019-12-17T16:42:31.802-05:00',
                },
                {
                    id: '29a198e5-5ac5-4ce4-ad5b-8097ba458b68',
                    value: 'Indiana',
                    alias: 'IN',
                    order: 15,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.804-05:00',
                    updated_at: '2019-12-17T16:42:31.804-05:00',
                },
                {
                    id: 'f94c99e3-6429-4408-9990-bc8486af7666',
                    value: 'Kansas',
                    alias: 'KS',
                    order: 16,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.805-05:00',
                    updated_at: '2019-12-17T16:42:31.805-05:00',
                },
                {
                    id: 'da4aafc2-8703-4a6c-bc33-83d59a058cf2',
                    value: 'Kentucky',
                    alias: 'KY',
                    order: 17,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.807-05:00',
                    updated_at: '2019-12-17T16:42:31.807-05:00',
                },
                {
                    id: '4690ee2c-16b8-42a3-8230-cf5376f09daa',
                    value: 'Louisiana',
                    alias: 'LA',
                    order: 18,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.809-05:00',
                    updated_at: '2019-12-17T16:42:31.809-05:00',
                },
                {
                    id: '38547e0a-075f-435e-9633-abfed3b3638c',
                    value: 'Massachusetts',
                    alias: 'MA',
                    order: 19,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.810-05:00',
                    updated_at: '2019-12-17T16:42:31.810-05:00',
                },
                {
                    id: '5dd63fa7-7f1e-4563-a004-9d9f0f95c0b0',
                    value: 'Maryland',
                    alias: 'MD',
                    order: 20,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.812-05:00',
                    updated_at: '2019-12-17T16:42:31.812-05:00',
                },
                {
                    id: '0da8925d-55a2-4b0d-8e9e-55f8f010b6c7',
                    value: 'Maine',
                    alias: 'ME',
                    order: 21,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.813-05:00',
                    updated_at: '2019-12-17T16:42:31.813-05:00',
                },
                {
                    id: 'c1c782ab-1b38-4400-aa8e-1bb9d3b2b049',
                    value: 'Michigan',
                    alias: 'MI',
                    order: 22,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.815-05:00',
                    updated_at: '2019-12-17T16:42:31.815-05:00',
                },
                {
                    id: 'ba2db58b-c527-4d79-8e56-3abaf6e27fed',
                    value: 'Minnesota',
                    alias: 'MN',
                    order: 23,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.817-05:00',
                    updated_at: '2019-12-17T16:42:31.817-05:00',
                },
                {
                    id: '81507e29-960c-470c-842b-50aaf8104941',
                    value: 'Missouri',
                    alias: 'MO',
                    order: 24,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.818-05:00',
                    updated_at: '2019-12-17T16:42:31.818-05:00',
                },
                {
                    id: '2a89ee96-3622-4019-80df-0ae0f29e4549',
                    value: 'Mississippi',
                    alias: 'MS',
                    order: 25,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.820-05:00',
                    updated_at: '2019-12-17T16:42:31.820-05:00',
                },
                {
                    id: '109613db-c601-4d23-94e5-9771b1a9546f',
                    value: 'Montana',
                    alias: 'MT',
                    order: 26,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.821-05:00',
                    updated_at: '2019-12-17T16:42:31.821-05:00',
                },
                {
                    id: 'af816a94-ced2-4ef4-ab0d-2dfd9a6dbf4e',
                    value: 'North Carolina',
                    alias: 'NC',
                    order: 27,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.823-05:00',
                    updated_at: '2019-12-17T16:42:31.823-05:00',
                },
                {
                    id: '8d2ac896-3fc3-4f50-a4f7-90f56c4717e2',
                    value: 'North Dakota',
                    alias: 'ND',
                    order: 28,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.825-05:00',
                    updated_at: '2019-12-17T16:42:31.825-05:00',
                },
                {
                    id: 'e9a232d9-a98a-4b4c-b268-c482e4eeb41e',
                    value: 'Nebraska',
                    alias: 'NE',
                    order: 29,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.826-05:00',
                    updated_at: '2019-12-17T16:42:31.826-05:00',
                },
                {
                    id: '350b4679-73c6-4630-a065-49a8239536fa',
                    value: 'New Hampshire',
                    alias: 'NH',
                    order: 30,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.828-05:00',
                    updated_at: '2019-12-17T16:42:31.828-05:00',
                },
                {
                    id: '14c198f3-3753-4f2b-a561-5168ca284988',
                    value: 'New Jersey',
                    alias: 'NJ',
                    order: 31,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.829-05:00',
                    updated_at: '2019-12-17T16:42:31.829-05:00',
                },
                {
                    id: '316ee461-128d-443c-8bb2-996cf59a712d',
                    value: 'New Mexico',
                    alias: 'NM',
                    order: 32,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.830-05:00',
                    updated_at: '2019-12-17T16:42:31.830-05:00',
                },
                {
                    id: 'bc14d119-5f28-4b81-b161-356d90cf2b4b',
                    value: 'Nevada',
                    alias: 'NV',
                    order: 33,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.832-05:00',
                    updated_at: '2019-12-17T16:42:31.832-05:00',
                },
                {
                    id: '4cf711d0-a7bb-4cd8-8be3-3961124d94c1',
                    value: 'New York',
                    alias: 'NY',
                    order: 34,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.833-05:00',
                    updated_at: '2019-12-17T16:42:31.833-05:00',
                },
                {
                    id: 'b341e361-2d71-49b8-9f3e-6ed969d321cf',
                    value: 'Ohio',
                    alias: 'OH',
                    order: 35,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.835-05:00',
                    updated_at: '2019-12-17T16:42:31.835-05:00',
                },
                {
                    id: 'db5da51e-5b18-40b0-8a67-0a66f4dbf54e',
                    value: 'Oklahoma',
                    alias: 'OK',
                    order: 36,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.836-05:00',
                    updated_at: '2019-12-17T16:42:31.836-05:00',
                },
                {
                    id: '5d3a94d5-4474-402f-b6f1-9ae4a1b037ad',
                    value: 'Oregon',
                    alias: 'OR',
                    order: 37,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.837-05:00',
                    updated_at: '2019-12-17T16:42:31.837-05:00',
                },
                {
                    id: 'a8ec024e-de75-43a5-a2a8-7c379d6edb7b',
                    value: 'Pennsylvania',
                    alias: 'PA',
                    order: 38,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.839-05:00',
                    updated_at: '2019-12-17T16:42:31.839-05:00',
                },
                {
                    id: '055472c8-b7a6-466e-be74-ba9661184dc2',
                    value: 'Rhode Island',
                    alias: 'RI',
                    order: 39,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.840-05:00',
                    updated_at: '2019-12-17T16:42:31.840-05:00',
                },
                {
                    id: 'aa5a6756-152a-434a-b5c3-db3f4dac0e61',
                    value: 'South Carolina',
                    alias: 'SC',
                    order: 40,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.841-05:00',
                    updated_at: '2019-12-17T16:42:31.841-05:00',
                },
                {
                    id: '25558575-3642-41ab-b8ba-d2d6c6d2636e',
                    value: 'South Dakota',
                    alias: 'SD',
                    order: 41,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.843-05:00',
                    updated_at: '2019-12-17T16:42:31.843-05:00',
                },
                {
                    id: '2be8b4da-6749-4f54-a1f3-7d6fef8e1f11',
                    value: 'Tennessee',
                    alias: 'TN',
                    order: 42,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.844-05:00',
                    updated_at: '2019-12-17T16:42:31.844-05:00',
                },
                {
                    id: 'f35dec58-8b5e-4aae-9a94-ca70b89c4c63',
                    value: 'Texas',
                    alias: 'TX',
                    order: 43,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.845-05:00',
                    updated_at: '2019-12-17T16:42:31.845-05:00',
                },
                {
                    id: '49a0ed62-f302-4cd0-b452-cedca448f259',
                    value: 'Utah',
                    alias: 'UT',
                    order: 44,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.847-05:00',
                    updated_at: '2019-12-17T16:42:31.847-05:00',
                },
                {
                    id: '12c2dd97-a15b-4042-8c89-643a58b78d80',
                    value: 'Virginia',
                    alias: 'VA',
                    order: 45,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.848-05:00',
                    updated_at: '2019-12-17T16:42:31.848-05:00',
                },
                {
                    id: '6d029706-7a75-43f5-9a04-cc443d74bc5f',
                    value: 'Vermont',
                    alias: 'VT',
                    order: 46,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.849-05:00',
                    updated_at: '2019-12-17T16:42:31.849-05:00',
                },
                {
                    id: '4253f6fe-fa34-4ff1-886e-f29f41b93b59',
                    value: 'Washington',
                    alias: 'WA',
                    order: 47,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.851-05:00',
                    updated_at: '2019-12-17T16:42:31.851-05:00',
                },
                {
                    id: '8d59836e-6fa1-40c2-87d4-1956b2400521',
                    value: 'Wisconsin',
                    alias: 'WI',
                    order: 48,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.852-05:00',
                    updated_at: '2019-12-17T16:42:31.852-05:00',
                },
                {
                    id: '355d99fb-4520-466d-beb2-3b3d394494ec',
                    value: 'West Virginia',
                    alias: 'WV',
                    order: 49,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.853-05:00',
                    updated_at: '2019-12-17T16:42:31.853-05:00',
                },
                {
                    id: '833b141f-96a8-4202-b8ad-2773a4b6453d',
                    value: 'Wyoming',
                    alias: 'WY',
                    order: 50,
                    question_id: '478b4411-8452-4130-9730-d09c81ed1578',
                    created_at: '2019-12-17T16:42:31.854-05:00',
                    updated_at: '2019-12-17T16:42:31.854-05:00',
                },
            ],
        },
    },
    {
        id: '2d591f18-a0d7-4f22-bffe-38b32fa4928c',
        value: '02116',
        choice_id: null,
        choice_ids: [],
        active: true,
        version: 6,
        display_type: 'public',
        application_form_id: 'c9e2496a-4471-4895-a89c-cf1a8328c429',
        is_completed: true,
        created_at: '2020-01-14T10:40:19.458-05:00',
        updated_at: '2020-01-14T15:36:42.963-05:00',
        question: {
            id: '866e0c39-1aee-4633-b835-a51a1b9d12d5',
            code: 'business_coverage_zipcode',
            text: 'Zipcode',
            error_text: null,
            help_text: null,
            order: 8,
            question_set_id: '090e27f1-9c5f-4941-a036-d41574ae7330',
            field_type: 'zipcode',
            multiple: false,
            autocomplete: false,
            min_value: 5,
            max_value: 5,
            min_date: null,
            max_date: null,
            pattern: '^\\d{5}$',
            is_hidden: false,
            is_active: false,
            is_sensitive: false,
            required: true,
            trackable: false,
            created_at: '2019-12-17T16:42:31.718-05:00',
            updated_at: '2019-12-17T16:42:31.982-05:00',
            question_group_id: 'd887ab1b-084d-4824-86b3-25a6b9efc8e6',
            reference_type: 'zipcode',
            placeholder: null,
            choices: [],
        },
    },
    {
        id: 'ab8c7fca-84b5-48ba-9707-d84679066e11',
        value: '{"address_components":[{"long_name":"500","short_name":"500","types":["street_number"]},{"long_name":"Boylston Street","short_name":"Boylston St","types":["route"]},{"long_name":"Back Bay","short_name":"Back Bay","types":["neighborhood","political"]},{"long_name":"Boston","short_name":"Boston","types":["locality","political"]},{"long_name":"Suffolk County","short_name":"Suffolk County","types":["administrative_area_level_2","political"]},{"long_name":"Massachusetts","short_name":"MA","types":["administrative_area_level_1","political"]},{"long_name":"United States","short_name":"US","types":["country","political"]},{"long_name":"02116","short_name":"02116","types":["postal_code"]}],"formatted_address":"500 Boylston St, Boston, MA 02116, USA","geometry":{"location":{"lat":42.3506354,"lng":-71.0740118},"viewport":{"south":42.3494420697085,"west":-71.07543753029148,"north":42.3521400302915,"east":-71.07273956970846}},"id":"5c572e20d25463aa682871204ad81510ec8292af","name":"500 Boylston St","place_id":"ChIJ-Um6Vgt644kRqlZC6dR5MzM","types":["premise"],"url":"https://maps.google.com/?q=500+Boylston+St,+Boston,+MA+02116,+USA&ftid=0x89e37a0b56ba49f9:0x333379d4e94256aa","utc_offset":-300,"vicinity":"Boston","html_attributions":[],"utc_offset_minutes":-300}',
        choice_id: null,
        choice_ids: [],
        active: true,
        version: 4,
        display_type: 'public',
        application_form_id: 'c9e2496a-4471-4895-a89c-cf1a8328c429',
        is_completed: true,
        created_at: '2020-01-14T10:40:19.180-05:00',
        updated_at: '2020-01-14T15:36:42.809-05:00',
        question: {
            id: '324f228b-5840-449d-a4cb-e626dedbb602',
            code: 'business_coverage_address',
            text: 'Physical address',
            error_text: null,
            help_text: null,
            order: 5,
            question_set_id: '090e27f1-9c5f-4941-a036-d41574ae7330',
            field_type: 'address',
            multiple: false,
            autocomplete: false,
            min_value: null,
            max_value: null,
            min_date: null,
            max_date: null,
            pattern: '',
            is_hidden: false,
            is_active: false,
            is_sensitive: false,
            required: false,
            trackable: false,
            created_at: '2019-12-17T16:42:31.647-05:00',
            updated_at: '2019-12-17T16:42:31.972-05:00',
            question_group_id: 'd887ab1b-084d-4824-86b3-25a6b9efc8e6',
            reference_type: 'address_json',
            placeholder: null,
            choices: [],
        },
    },
];
describe('bp-sdk-address-group', () => {
    describe('render', () => {
        it('renders nothing if answers are missing in map', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            await page.waitForChanges();
            const element = page.body.querySelector('bp-sdk-dynamic-input-redux-container');
            expect(element).toBeNull();
        });
        it('renders nothing if answers are missing in map', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            instance.answers = answers;
            await page.waitForChanges();
            const elements = page.body.querySelectorAll('bp-sdk-dynamic-input-redux-container');
            expect(elements.length).toBe(6);
        });
        it('renders external component if defined', async () => {
            const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            await page.waitForChanges();
            const element = page.root.querySelector('div');
            expect(element).toBeFalsy();
            whenDefinedMock.mockRestore();
        });
    });
    describe('onAnswersChange', () => {
        it('should update the map in expected manner', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const reference_type = 'some type';
            const instance = page.rootInstance;
            const answers = [
                {
                    question: {
                        reference_type,
                    },
                },
                {
                    question: {},
                },
                {},
                null,
            ];
            instance.onAnswersChange(answers);
            expect(Object.keys(instance.answerMap).length).toBe(1);
            expect(instance.answerMap[reference_type]).toBe(answers[0]);
        });
    });
    describe('onPlacesUpdate', () => {
        let event;
        beforeEach(() => {
            event = new CustomEvent('placeChange', {
                detail: {
                    address_components: [
                        { long_name: '0106', short_name: '0106', types: ['street_number'] },
                        {
                            long_name: 'Peachtree Forest Terrace',
                            short_name: 'Peachtree Forest Terrace',
                            types: ['route'],
                        },
                        {
                            long_name: 'Peachtree Corners',
                            short_name: 'Peachtree Corners',
                            types: ['locality', 'political'],
                        },
                        {
                            long_name: 'Gwinnett County',
                            short_name: 'Gwinnett County',
                            types: ['administrative_area_level_2', 'political'],
                        },
                        {
                            long_name: 'Georgia',
                            short_name: 'GA',
                            types: ['administrative_area_level_1', 'political'],
                        },
                        {
                            long_name: 'United States',
                            short_name: 'US',
                            types: ['country', 'political'],
                        },
                        { long_name: '30092', short_name: '30092', types: ['postal_code'] },
                    ],
                    adr_address: '<span class="street-address">0106 Peachtree Forest Terrace</span>, <span class="locality">Peachtree Corners</span>, <span class="region">GA</span> <span class="postal-code">30092</span>, <span class="country-name">USA</span>',
                    formatted_address: '0106 Peachtree Forest Terrace, Peachtree Corners, GA 30092, USA',
                    geometry: {
                        location: { lat: 33.9635462, lng: -84.241783 },
                        viewport: {
                            south: 33.96249141970851,
                            west: -84.24358583029152,
                            north: 33.96518938029151,
                            east: -84.2408878697085,
                        },
                    },
                    icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png',
                    id: 'f31ce1ea3c736a25dd2cd1bfe0a00a887f188b9b',
                    name: '0106 Peachtree Forest Terrace',
                    place_id: 'ChIJ46kV2vGg9YgRuGtsERqelys',
                    plus_code: {
                        compound_code: 'XQ75+C7 Peachtree Corners, Georgia, United States',
                        global_code: '865QXQ75+C7',
                    },
                    reference: 'ChIJ46kV2vGg9YgRuGtsERqelys',
                    scope: 'GOOGLE',
                    types: ['street_address'],
                    url: 'https://maps.google.com/?q=0106+Peachtree+Forest+Terrace,+Peachtree+Corners,+GA+30092,+USA&ftid=0x88f5a0f1da15a9e3:0x2b979e1a116c6bb8',
                    utc_offset: -300,
                    vicinity: 'Peachtree Corners',
                    html_attributions: [],
                    utc_offset_minutes: -300,
                },
            });
        });
        it('should do nothing use external', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            jest.useFakeTimers({ legacyFakeTimers: true });
            instance.useExternal = true;
            jest.spyOn(instance.saveAnswer, 'emit').mockImplementation(() => ({}));
            instance.onPlacesUpdate(event);
            jest.runAllTimers();
            expect(instance.saveAnswer.emit).toHaveBeenCalledTimes(0);
        });
        it('make expected calls', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            jest.useFakeTimers({ legacyFakeTimers: true });
            instance.answers = answers;
            await page.waitForChanges();
            jest.spyOn(instance.saveAnswer, 'emit').mockImplementation(() => ({}));
            instance.onPlacesUpdate(event);
            jest.runAllTimers();
            // calls update for  city, state, zipcode, and address_json
            expect(instance.saveAnswer.emit).toHaveBeenCalledTimes(5);
        });
        it('make does nothing if no answers', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            jest.useFakeTimers({ legacyFakeTimers: true });
            await page.waitForChanges();
            jest.spyOn(instance.saveAnswer, 'emit').mockImplementation(() => ({}));
            instance.onPlacesUpdate(event);
            jest.runAllTimers();
            expect(instance.saveAnswer.emit).toHaveBeenCalledTimes(0);
        });
        it('skips choice if missing', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            jest.useFakeTimers({ legacyFakeTimers: true });
            instance.answers = answers.map((item) => {
                item = Object.assign(Object.assign({}, item), { question: Object.assign({}, item.question) });
                if (item.question.reference_type === QuestionReferenceType.State) {
                    item.question.choices = [];
                }
                return item;
            });
            await page.waitForChanges();
            jest.spyOn(instance.saveAnswer, 'emit').mockImplementation(() => ({}));
            instance.onPlacesUpdate(event);
            jest.runAllTimers();
            // does not call state update
            expect(instance.saveAnswer.emit).toHaveBeenCalledTimes(4);
        });
        it('make does nothing if place information missing', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            instance.answers = answers;
            jest.useFakeTimers({ legacyFakeTimers: true });
            await page.waitForChanges();
            jest.spyOn(instance.saveAnswer, 'emit').mockImplementation(() => ({}));
            instance.onPlacesUpdate(new CustomEvent('placeChanged', { detail: { name: '' } }));
            jest.runAllTimers();
            // only calls address_json update
            expect(instance.saveAnswer.emit).toHaveBeenCalledTimes(1);
        });
        it('emits addressMissingComponents event if some place information missing', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-address-group></bp-sdk-address-group>',
                components: [BpSdkAddressGroup],
            });
            const instance = page.rootInstance;
            instance.answers = answers;
            jest.useFakeTimers({ legacyFakeTimers: true });
            await page.waitForChanges();
            jest.spyOn(instance.addressMissingComponents, 'emit').mockImplementation(() => ({}));
            instance.onPlacesUpdate(new CustomEvent('placeChanged', {
                detail: {
                    name: '',
                    address_components: [
                        {
                            long_name: 'Polaris Place',
                            short_name: 'Polaris Pl',
                            types: ['route'],
                        },
                        {
                            long_name: 'North Saint Paul',
                            short_name: 'North St Paul',
                            types: ['locality', 'political'],
                        },
                        {
                            long_name: 'Ramsey County',
                            short_name: 'Ramsey County',
                            types: ['administrative_area_level_2', 'political'],
                        },
                        {
                            long_name: 'Minnesota',
                            short_name: 'MN',
                            types: ['administrative_area_level_1', 'political'],
                        },
                        {
                            long_name: 'United States',
                            short_name: 'US',
                            types: ['country', 'political'],
                        },
                        {
                            long_name: '55109',
                            short_name: '55109',
                            types: ['postal_code'],
                        },
                    ],
                },
            }));
            jest.runAllTimers();
            expect(instance.addressMissingComponents.emit).toHaveBeenCalledTimes(1);
        });
    });
});
