update the lookups list

This commit is contained in:
2026-09-07 15:08:08 +03:30
parent 80e112f09b
commit c7cd9e8ce5
11 changed files with 1161 additions and 72 deletions

View File

@@ -2,7 +2,10 @@ import {
filterPoliciesByLine,
insuranceLineLabel,
parseLastCarPolicyInput,
pickFanavaranPlaqueLookupFields,
pickFanavaranVehicleFromInquiry,
pickVehicleId,
pickVinFromPartyVehicle,
plaqueLetterFromMiddleCode,
plaqueMatchesVehicle,
selectLastAmongCarMatches,
@@ -84,6 +87,57 @@ describe("fanavaran last car policy", () => {
);
});
it("picks the inquiry row matching policy VehicleId and VIN from the party", () => {
const inquired = [
{ Id: 1, UsedId: 1, VehicleKindId: 10 },
{
Id: 3379978,
UsedId: 84,
VehicleKindId: 5950,
VIN: "NAS451100P4934023",
},
];
expect(pickFanavaranVehicleFromInquiry(inquired, 3379978)).toEqual(
inquired[1],
);
expect(
pickVinFromPartyVehicle({
vehicle: { vin: "nas451100p4934023" },
}),
).toBe("NAS451100P4934023");
expect(
pickVinFromPartyVehicle({
vehicle: {
inquiry: { mapped: { VIN: "NAS451100P4934023" } },
},
}),
).toBe("NAS451100P4934023");
});
it("reads plaque kind and sample from VIN inquiry for the lookup filter", () => {
expect(
pickFanavaranPlaqueLookupFields({
PlaqueKindId: 15,
PlaqueSampleId: 24,
PlaqueCityId: null,
PlaqueLeftNo: "62",
PlaqueMiddleCodeId: 14,
PlaqueRightNo: "278",
PlaqueSerial: "50",
PlaqueNo: "278و62",
}),
).toEqual({
kindId: 15,
sampleId: 24,
cityId: null,
leftNo: "62",
middleCodeId: 14,
rightNo: "278",
serial: "50",
plaqueNo: "278و62",
});
});
it("matches VIN against ChassisNo when VIN is empty", () => {
expect(
vehicleMatchesCar(