done vehicle hull accessories

This commit is contained in:
2026-11-12 15:05:16 +03:30
parent cbdf4fd2bc
commit 7ab6b4c03d
8 changed files with 154 additions and 33 deletions
@@ -68,17 +68,24 @@ describe("hull expertise policy accessory mapping", () => {
);
});
it("does not invent a factory-bundle Id when AccessoryKindId is missing on that row", async () => {
it("maps unmatched parts onto the policy factory-bundle VehicleHullAccessoryId", async () => {
const { build } = setup([
{ Id: 900003, AccessoryDesc: "کليه قطعات فابريک" },
{
Id: 3061139,
AccessoryKindId: 112,
AccessoryDesc: "کليه قطعات فابريک",
},
]);
const { payload, warnings } = await build();
expect(
payload.DmgSections.map((row: any) => row.VehicleHullAccessoryId),
).toEqual([null, null]);
).toEqual([3061139, 3061139]);
expect(payload.DmgSections.map((row: any) => row.AccessoryKindId)).toEqual([
9, 13,
]);
expect(warnings).toEqual(
expect.arrayContaining([
expect.stringContaining("Refusing to invent VehicleHullAccessoryId"),
expect.stringContaining("using factory bundle VehicleHullAccessoryId=3061139"),
]),
);
});
@@ -111,7 +118,7 @@ describe("hull expertise policy accessory mapping", () => {
expect(warnings).toEqual(
expect.arrayContaining([
expect.stringContaining("dmg-accessories lookup failed"),
expect.stringContaining("Refusing to invent VehicleHullAccessoryId"),
expect.stringContaining("Leaving VehicleHullAccessoryId null"),
]),
);
});
@@ -140,7 +147,9 @@ describe("hull expertise policy accessory mapping", () => {
).toEqual([null, null]);
expect(warnings).toEqual(
expect.arrayContaining([
expect.stringMatching(/VehicleHullAccessoryId|Refusing to invent/),
expect.stringMatching(
/VehicleHullAccessoryId|Leaving VehicleHullAccessoryId null/,
),
]),
);
},