{"ScriptPreparationCode":"const testObj = {\r\n axaFrInsuranceAgreement: {\r\n partyRoleInAgreementGroup: {\r\n agreementHolder: {\r\n\t\trelatedParty: {\r\n organization: {\r\n establishment: [\r\n {\r\n organizationDetailGroup: {\r\n organizationInsuranceExperience: [\r\n {\r\n claimInPeriodRecords: [\r\n {\r\n effectivePeriod: {\r\n startDateTime: \u0022string\u0022\r\n }\r\n }\r\n ],\r\n }\r\n ],\r\n },\r\n }\r\n ],\r\n }\r\n }\r\n },\r\n },\r\n },\r\n};\r\n\r\nconst tryGetFnSafely = (fn, defaultVal) =\u003E {\r\n try {\r\n return fn();\r\n } catch (e) {\r\n return defaultVal;\r\n }\r\n};","TestCases":[{"Name":"Optional chaining","Code":"const testObj = {\r\n axaFrInsuranceAgreement: {\r\n partyRoleInAgreementGroup: {\r\n agreementHolder: {\r\n\t\trelatedParty: {\r\n organization: {\r\n establishment: [\r\n {\r\n organizationDetailGroup: {\r\n organizationInsuranceExperience: [\r\n {\r\n claimInPeriodRecords: [\r\n {\r\n effectivePeriod: {\r\n startDateTime: \u0022string\u0022\r\n }\r\n }\r\n ],\r\n }\r\n ],\r\n },\r\n }\r\n ],\r\n }\r\n }\r\n },\r\n },\r\n },\r\n};\r\nconst testValueOk = testObj?.axaFrInsuranceAgreement?.partyRoleInAgreementGroup?.agreementHolder?.relatedParty?.organization?.establishment?.[0]?.organizationDetailGroup?.organizationInsuranceExperience?.[0]?.claimInPeriodRecords?.[0]?.effectivePeriod?.startDateTime;\r\nconst testValueErr = testObj?.axaFrInsuranceAgreement?.partyRoleInAgreementGroup?.agreementHolder?.relatedParty?.organization?.establishment?.[1]?.organizationDetailGroup?.organizationInsuranceExperience?.[1]?.claimInPeriodRecords?.[0]?.effectivePeriod?.startDateTime;","IsDeferred":false},{"Name":"Try catch","Code":"const testObj = {\r\n axaFrInsuranceAgreement: {\r\n partyRoleInAgreementGroup: {\r\n agreementHolder: {\r\n\t\trelatedParty: {\r\n organization: {\r\n establishment: [\r\n {\r\n organizationDetailGroup: {\r\n organizationInsuranceExperience: [\r\n {\r\n claimInPeriodRecords: [\r\n {\r\n effectivePeriod: {\r\n startDateTime: \u0022string\u0022\r\n }\r\n }\r\n ],\r\n }\r\n ],\r\n },\r\n }\r\n ],\r\n }\r\n }\r\n },\r\n },\r\n },\r\n};\r\nconst tryGetFnSafely = (fn, defaultVal) =\u003E {\r\n try {\r\n return fn();\r\n } catch (e) {\r\n return defaultVal;\r\n }\r\n};\r\nconst testValueOk = tryGetFnSafely(() =\u003E testObj.axaFrInsuranceAgreement.partyRoleInAgreementGroup.agreementHolder.relatedParty.organization.establishment[0].organizationDetailGroup.organizationInsuranceExperience[0].claimInPeriodRecords[0].effectivePeriod.startDateTime, null);\r\nconst testValueErr = tryGetFnSafely(() =\u003E testObj.axaFrInsuranceAgreement.partyRoleInAgreementGroup.agreementHolder.relatedParty.organization.establishment[1].organizationDetailGroup.organizationInsuranceExperience[1].claimInPeriodRecords[0].effectivePeriod.startDateTime, null);","IsDeferred":false}]}