fanavaran driver and owner id (GEN..44 defauts) - culprit type id dynamic

This commit is contained in:
2026-09-28 16:13:32 +03:30
parent a74e20b25f
commit 165afe56ae
7 changed files with 303 additions and 36 deletions
@@ -1,5 +1,7 @@
import { InquiryParticipantRole } from "src/common/dto/inquiry-participants.dto";
import {
FANAVARAN_CULPRIT_TYPE_DRIVER_NOT_INSURER,
FANAVARAN_CULPRIT_TYPE_INSURER,
FANAVARAN_DUMMY_LICENCE_ISSU_DATE,
formatFanavaranLicenceIssuDate,
resolveDriverFromParty,
@@ -8,6 +10,7 @@ import {
resolveFanavaranLicenceNo,
resolveOwnerFromParty,
resolvePolicyholderFromParty,
resolveThirdPartyCulpritTypeId,
} from "./fanavaran-party-roles";
describe("fanavaran-party-roles", () => {
@@ -105,6 +108,31 @@ describe("fanavaran-party-roles", () => {
).toBe("0080086519");
});
it("maps CulpritTypeId 338 when guilty driver ≠ insurer", () => {
expect(resolveThirdPartyCulpritTypeId(partyWithDistinctRoles)).toBe(
FANAVARAN_CULPRIT_TYPE_DRIVER_NOT_INSURER,
);
});
it("maps CulpritTypeId 337 when guilty driver is the insurer", () => {
expect(
resolveThirdPartyCulpritTypeId({
participants: [
{
participantId: "SAME",
nationalCode: "0080086519",
birthday: "1364/06/28",
},
],
participantRoles: {
driver: "SAME",
thirdPartyPolicyholder: "SAME",
},
person: { driverIsInsurer: true },
}),
).toBe(FANAVARAN_CULPRIT_TYPE_INSURER);
});
it("formats compact Jalali driverLicenseDate", () => {
expect(formatFanavaranLicenceIssuDate(13980601)).toBe("1398/06/01");
});