forked from Yara724/api
Complete inquiry participant flow coverage
This commit is contained in:
@@ -70,6 +70,26 @@ describe("buildInsurerFileReport", () => {
|
||||
},
|
||||
{
|
||||
role: "SECOND",
|
||||
participants: [
|
||||
{
|
||||
participantId: "DRIVER",
|
||||
fullName: "راننده نمونه",
|
||||
nationalCode: "0012345678",
|
||||
birthday: "1370/01/01",
|
||||
licenseNumber: "LIC-1",
|
||||
},
|
||||
{
|
||||
participantId: "VEHICLE_OWNER",
|
||||
fullName: "زیان دیده نمونه",
|
||||
nationalCode: "1234567890",
|
||||
birthday: "1370/01/01",
|
||||
},
|
||||
],
|
||||
participantRoles: {
|
||||
driver: "DRIVER",
|
||||
vehicleOwner: "VEHICLE_OWNER",
|
||||
thirdPartyPolicyholder: "VEHICLE_OWNER",
|
||||
},
|
||||
person: {
|
||||
userId: "damaged-user-id",
|
||||
fullName: "زیان دیده نمونه",
|
||||
@@ -165,61 +185,89 @@ describe("buildInsurerFileReport", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(getFieldValue(report, PR.ownerSection, PR.name)).toBe("زیان دیده نمونه");
|
||||
expect(getFieldValue(report, PR.guiltyOwnerSection, PR.name)).toBe("مقصر نمونه");
|
||||
expect(getFieldValue(report, PR.guiltyOwnerSection, PR.phone)).toBe("09120000000");
|
||||
expect(getFieldValue(report, PR.ownerSection, PR.name)).toBe(
|
||||
"زیان دیده نمونه",
|
||||
);
|
||||
expect(
|
||||
getFieldValue(report, PR.damagedParticipantsSection, PR.driverRole),
|
||||
).toContain("راننده نمونه");
|
||||
expect(
|
||||
getFieldValue(
|
||||
report,
|
||||
PR.damagedParticipantsSection,
|
||||
PR.thirdPartyPolicyholderRole,
|
||||
),
|
||||
).toContain("1234567890");
|
||||
expect(getFieldValue(report, PR.guiltyOwnerSection, PR.name)).toBe(
|
||||
"مقصر نمونه",
|
||||
);
|
||||
expect(getFieldValue(report, PR.guiltyOwnerSection, PR.phone)).toBe(
|
||||
"09120000000",
|
||||
);
|
||||
expect(getFieldValue(report, PR.guiltyOwnerSection, PR.nationalCode)).toBe(
|
||||
"0987654321",
|
||||
);
|
||||
|
||||
expect(getFieldValue(report, PR.damagedThirdPartyInsuranceSection, PR.policyNumber)).toBe(
|
||||
"TP-DAMAGED-001",
|
||||
);
|
||||
expect(getFieldValue(report, PR.guiltyThirdPartyInsuranceSection, PR.policyNumber)).toBe(
|
||||
"TP-GUILTY-001",
|
||||
);
|
||||
expect(getFieldValue(report, PR.damagedCarBodyInsuranceSection, PR.policyNumber)).toBe(
|
||||
"CB-DAMAGED-001",
|
||||
);
|
||||
expect(getFieldValue(report, PR.guiltyCarBodyInsuranceSection, PR.policyNumber)).toBe(
|
||||
"CB-GUILTY-001",
|
||||
);
|
||||
|
||||
expect(getFieldValue(report, PR.damagedVehicleSection, "خودرو / نام خودرو")).toBe(
|
||||
"207",
|
||||
);
|
||||
expect(getFieldValue(report, PR.guiltyVehicleSection, "خودرو / نام خودرو")).toBe(
|
||||
"206",
|
||||
);
|
||||
|
||||
expect(getFieldValue(report, PR.damagedStatementSection, PR.partyDescription)).toBe(
|
||||
"توضیحات زیاندیده",
|
||||
);
|
||||
expect(getFieldValue(report, PR.damagedStatementSection, PR.claimsDamage)).toBe(
|
||||
"بله",
|
||||
);
|
||||
expect(
|
||||
getFieldValue(report, PR.damagedStatementSection, PR.acceptsExpertOpinion),
|
||||
getFieldValue(
|
||||
report,
|
||||
PR.damagedThirdPartyInsuranceSection,
|
||||
PR.policyNumber,
|
||||
),
|
||||
).toBe("TP-DAMAGED-001");
|
||||
expect(
|
||||
getFieldValue(
|
||||
report,
|
||||
PR.guiltyThirdPartyInsuranceSection,
|
||||
PR.policyNumber,
|
||||
),
|
||||
).toBe("TP-GUILTY-001");
|
||||
expect(
|
||||
getFieldValue(report, PR.damagedCarBodyInsuranceSection, PR.policyNumber),
|
||||
).toBe("CB-DAMAGED-001");
|
||||
expect(
|
||||
getFieldValue(report, PR.guiltyCarBodyInsuranceSection, PR.policyNumber),
|
||||
).toBe("CB-GUILTY-001");
|
||||
|
||||
expect(
|
||||
getFieldValue(report, PR.damagedVehicleSection, "خودرو / نام خودرو"),
|
||||
).toBe("207");
|
||||
expect(
|
||||
getFieldValue(report, PR.guiltyVehicleSection, "خودرو / نام خودرو"),
|
||||
).toBe("206");
|
||||
|
||||
expect(
|
||||
getFieldValue(report, PR.damagedStatementSection, PR.partyDescription),
|
||||
).toBe("توضیحات زیاندیده");
|
||||
expect(
|
||||
getFieldValue(report, PR.damagedStatementSection, PR.claimsDamage),
|
||||
).toBe("بله");
|
||||
expect(
|
||||
getFieldValue(
|
||||
report,
|
||||
PR.damagedStatementSection,
|
||||
PR.acceptsExpertOpinion,
|
||||
),
|
||||
).toBe("خیر");
|
||||
expect(getFieldValue(report, PR.guiltyStatementSection, PR.partyDescription)).toBe(
|
||||
"توضیحات مقصر",
|
||||
);
|
||||
expect(getFieldValue(report, PR.guiltyStatementSection, PR.admitsGuilt)).toBe(
|
||||
"بله",
|
||||
);
|
||||
expect(
|
||||
getFieldValue(report, PR.guiltyStatementSection, PR.partyDescription),
|
||||
).toBe("توضیحات مقصر");
|
||||
expect(
|
||||
getFieldValue(report, PR.guiltyStatementSection, PR.admitsGuilt),
|
||||
).toBe("بله");
|
||||
expect(
|
||||
getFieldValue(report, PR.guiltyStatementSection, PR.acceptsExpertOpinion),
|
||||
).toBe("بله");
|
||||
|
||||
expect(getFieldValue(report, PR.fanavaranSection, PR.fanavaranClaimNo)).toBe(
|
||||
"111",
|
||||
);
|
||||
expect(
|
||||
getFieldValue(report, PR.fanavaranSection, PR.fanavaranClaimNo),
|
||||
).toBe("111");
|
||||
expect(
|
||||
getFieldValue(report, PR.fanavaranSection, PR.fanavaranExpertiseId),
|
||||
).toBe("444");
|
||||
expect(getFieldValue(report, PR.fanavaranSection, PR.fanavaranPolicyId)).toBe(
|
||||
"555",
|
||||
);
|
||||
expect(
|
||||
getFieldValue(report, PR.fanavaranSection, PR.fanavaranPolicyId),
|
||||
).toBe("555");
|
||||
|
||||
expect(getFieldValue(report, PR.timelineSection, PR.fileRegisteredAt)).toBe(
|
||||
"1405/05/19 13:23",
|
||||
@@ -228,15 +276,15 @@ describe("buildInsurerFileReport", () => {
|
||||
getFieldValue(report, PR.timelineSection, PR.evaluationRegisteredAt),
|
||||
).toBe("1405/05/19 16:00");
|
||||
|
||||
expect(getFieldValue(report, PR.evaluationSection, PR.evaluationResult)).toBe(
|
||||
"تأیید شده",
|
||||
);
|
||||
expect(getFieldValue(report, PR.evaluationSection, PR.evaluationExpert)).toBe(
|
||||
"کارشناس خسارت نمونه",
|
||||
);
|
||||
expect(getFieldValue(report, PR.evaluationSection, PR.evaluationResponse)).toBe(
|
||||
"نیاز به تعویض سپر جلو",
|
||||
);
|
||||
expect(
|
||||
getFieldValue(report, PR.evaluationSection, PR.evaluationResult),
|
||||
).toBe("تأیید شده");
|
||||
expect(
|
||||
getFieldValue(report, PR.evaluationSection, PR.evaluationExpert),
|
||||
).toBe("کارشناس خسارت نمونه");
|
||||
expect(
|
||||
getFieldValue(report, PR.evaluationSection, PR.evaluationResponse),
|
||||
).toBe("نیاز به تعویض سپر جلو");
|
||||
expect(getFieldValue(report, "قیمت قطعات", "قطعه ۱ / نام قطعه")).toBe(
|
||||
"سپر جلو",
|
||||
);
|
||||
@@ -345,9 +393,9 @@ describe("buildInsurerFileReport", () => {
|
||||
});
|
||||
|
||||
const fields = report.sections.flatMap((section) => section.fields);
|
||||
expect(fields.find((field) => field.label === "خودرو / خودرو نو")?.value).toBe(
|
||||
"بله",
|
||||
);
|
||||
expect(
|
||||
fields.find((field) => field.label === "خودرو / خودرو نو")?.value,
|
||||
).toBe("بله");
|
||||
expect(fields.some((field) => field.value === "خیر")).toBe(true);
|
||||
expect(fields.some((field) => field.value === "true")).toBe(false);
|
||||
expect(fields.some((field) => field.value === "false")).toBe(false);
|
||||
@@ -372,10 +420,12 @@ describe("buildInsurerFileReport", () => {
|
||||
});
|
||||
|
||||
const fields = report.sections.flatMap((section) => section.fields);
|
||||
expect(fields.some((field) => String(field.value).includes("ESG"))).toBe(false);
|
||||
expect(fields.some((field) => String(field.value).includes("TEJARAT"))).toBe(
|
||||
expect(fields.some((field) => String(field.value).includes("ESG"))).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
fields.some((field) => String(field.value).includes("TEJARAT")),
|
||||
).toBe(false);
|
||||
expect(fields.some((field) => field.label.includes("منبع"))).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user