updated the fucking mf fanavaran

This commit is contained in:
2026-09-07 16:33:15 +03:30
parent 395e3dbe63
commit b9bffdccc1
5 changed files with 423 additions and 114 deletions

View File

@@ -1,5 +1,6 @@
import {
asPartyInquiryRows,
collectPersonNationalCodes,
parseJalaliDateParts,
pickPersonBirthday,
pickPersonNationalCode,
@@ -24,8 +25,17 @@ describe("selectFanavaranDriverId", () => {
expect(selectFanavaranDriverId([{ Id: 20, RoleId: 166 }], true)).toBe(20);
});
it("unwraps a wrapped Fanavaran payload", () => {
expect(selectFanavaranDriverId({ value: rows }, true)).toBe(10);
it("picks 4773521 from a real Fanavaran unique-identifier response", () => {
expect(
selectFanavaranDriverId(
[
{ Id: 4773521, RoleId: 161 },
{ Id: 4773521, RoleId: 163 },
{ Id: 4773521, RoleId: 166 },
],
true,
),
).toBe(4773521);
});
});
@@ -51,11 +61,16 @@ describe("pickPersonNationalCode / birthday", () => {
});
describe("asPartyInquiryRows", () => {
it("parses compact Jalali birthday 13480313", () => {
expect(parseJalaliDateParts("13480313")).toEqual({
year: 1348,
month: 3,
day: 13,
it("normalizes Persian digits and compact insurer birthday 13640628", () => {
expect(
collectPersonNationalCodes({
nationalCodeOfInsurer: "۰۰۸۰۰۸۶۵۱۹",
}),
).toEqual(["0080086519"]);
expect(parseJalaliDateParts(13640628)).toEqual({
year: 1364,
month: 6,
day: 28,
});
});
});