vehicle hull accessories debug , either success or clear YARA error

This commit is contained in:
2026-11-12 13:01:32 +03:30
parent 3fe897031a
commit af9bed3b0d
6 changed files with 140 additions and 42 deletions
@@ -68,19 +68,24 @@ describe("hull expertise policy accessory mapping", () => {
);
});
it("uses a factory bundle only when it belongs to the current policy", async () => {
it("does not invent a factory-bundle Id when AccessoryKindId is missing on that row", async () => {
const { build } = setup([
{ Id: 900003, AccessoryDesc: "کليه قطعات فابريک" },
]);
const { payload } = await build();
const { payload, warnings } = await build();
expect(
payload.DmgSections.map((row: any) => row.VehicleHullAccessoryId),
).toEqual([900003, 900003]);
).toEqual([null, null]);
expect(warnings).toEqual(
expect.arrayContaining([
expect.stringContaining("Refusing to invent VehicleHullAccessoryId"),
]),
);
});
it("does not replace unavailable lookup values with 5485 or 1", async () => {
const { service, build } = setup([
{ Id: 2810613, AccessoryDesc: "کليه قطعات فابريک" },
{ Id: 2810613, AccessoryKindId: 9, AccessoryDesc: "سپر جلو" },
]);
service.getFanavaranLookupRows.mockResolvedValue([]);
const { payload, warnings } = await build();
@@ -103,7 +108,12 @@ describe("hull expertise policy accessory mapping", () => {
expect(
payload.DmgSections.map((row: any) => row.VehicleHullAccessoryId),
).toEqual([null, null]);
expect(warnings).toHaveLength(2);
expect(warnings).toEqual(
expect.arrayContaining([
expect.stringContaining("dmg-accessories lookup failed"),
expect.stringContaining("Refusing to invent VehicleHullAccessoryId"),
]),
);
});
it("reports a missing hull PolicyId instead of using the claim ID as a policy", async () => {
@@ -130,9 +140,26 @@ describe("hull expertise policy accessory mapping", () => {
).toEqual([null, null]);
expect(warnings).toEqual(
expect.arrayContaining([
expect.stringContaining("VehicleHullAccessoryId"),
expect.stringMatching(/VehicleHullAccessoryId|Refusing to invent/),
]),
);
},
);
it("matches by part caption and keeps AccessoryKindId from that policy row", async () => {
const { build } = setup([
{
Id: 900010,
AccessoryKindId: 44,
AccessoryDesc: "سپر جلو",
},
]);
const { payload, warnings } = await build();
expect(payload.DmgSections[0]).toMatchObject({
VehicleHullAccessoryId: 900010,
AccessoryKindId: 44,
});
expect(payload.DmgSections[1].VehicleHullAccessoryId).toBeNull();
expect(warnings.some((w) => w.includes("چراغ جلو چپ"))).toBe(true);
});
});