fanavaran car body and third_party lookup codings applied

This commit is contained in:
2026-09-06 10:45:40 +03:30
parent 5f714e1456
commit 02edd0b2ca
5 changed files with 160 additions and 2 deletions

View File

@@ -1,9 +1,12 @@
import {
filterPoliciesByLine,
insuranceLineLabel,
parseLastCarPolicyInput,
pickVehicleId,
plaqueLetterFromMiddleCode,
plaqueMatchesVehicle,
selectLastAmongCarMatches,
toAppPlaque,
vehicleMatchesCar,
} from "./fanavaran-last-car-policy";
@@ -40,6 +43,28 @@ describe("fanavaran last car policy", () => {
});
});
it("maps insurance line ids to CAR_BODY and THIRD_PARTY", () => {
expect(insuranceLineLabel(4)).toBe("CAR_BODY");
expect(insuranceLineLabel(5)).toBe("THIRD_PARTY");
});
it("converts PlaqueMiddleCodeId 5 to د and builds app plaque parts", () => {
expect(plaqueLetterFromMiddleCode(5)).toBe("د");
expect(
toAppPlaque({
PlaqueLeftNo: "29",
PlaqueMiddleCodeId: 5,
PlaqueRightNo: "782",
PlaqueSerial: "60",
}),
).toEqual({
leftTwoDigits: "29",
serialLetter: "د",
threeDigits: "782",
rightTwoDigits: "60",
});
});
it("keeps only the requested insurance line", () => {
const rows = filterPoliciesByLine(
[