forked from Yara724/api
Fixed unstable parts fetching from fanavaran
This commit is contained in:
@@ -2,6 +2,7 @@ import { ClaimVehicleTypeV2 } from "src/static/outer-car-parts-catalog";
|
||||
import { buildCoefficientsFromPartSeverities } from "./claim-price-drop";
|
||||
import {
|
||||
catalogPartIdFromSelectedPart,
|
||||
normalizeDamageSelectedParts,
|
||||
resolveCatalogPartByPartId,
|
||||
resolvePartForExpertReply,
|
||||
resolveSelectedPartByPartId,
|
||||
@@ -86,6 +87,31 @@ describe("resolveSelectedPartByPartId", () => {
|
||||
expect(catalogPartIdFromSelectedPart(row)).toBeNull();
|
||||
});
|
||||
|
||||
it("preserves a live Fanavaran id that is newer than the static snapshot", () => {
|
||||
const [row] = normalizeDamageSelectedParts(
|
||||
[{
|
||||
id: 96,
|
||||
name: "96",
|
||||
side: "",
|
||||
label_fa: "تیوتر",
|
||||
catalogKey: "96",
|
||||
}],
|
||||
ClaimVehicleTypeV2.SEDAN,
|
||||
);
|
||||
|
||||
expect(row).toEqual({
|
||||
id: 96,
|
||||
name: "96",
|
||||
side: "",
|
||||
label_fa: "تیوتر",
|
||||
catalogKey: "96",
|
||||
});
|
||||
expect(catalogPartIdFromSelectedPart(row)).toBe(96);
|
||||
expect(resolvePartForExpertReply(96, [row], ClaimVehicleTypeV2.SEDAN)).toBe(
|
||||
row,
|
||||
);
|
||||
});
|
||||
|
||||
it("recovers outer part wrongly stored as internal with Persian label", () => {
|
||||
const fixed = sanitizeDamageSelectedPartV2(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user