forked from Yara724/api
Fixed FaLabels
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { getEventFaDescription, getEventFaLabel } from "./timeline-fa-labels";
|
||||
import {
|
||||
getEventFaDescription,
|
||||
getEventFaLabel,
|
||||
localizeTimelineMetadata,
|
||||
} from "./timeline-fa-labels";
|
||||
|
||||
describe("insurer timeline Persian labels", () => {
|
||||
it("localizes the user-submission detail shown to insurers", () => {
|
||||
@@ -22,4 +26,73 @@ describe("insurer timeline Persian labels", () => {
|
||||
"رویدادی در روند پرونده ثبت شد.",
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["FIRST_INITIAL_FORM_SUBMITTED", "فرم اولیه طرف اول ثبت شد"],
|
||||
["FIRST_LOCATION_SUBMITTED", "موقعیت مکانی طرف اول ثبت شد"],
|
||||
["FIRST_VOICE_UPLOADED", "صدای طرف اول بارگذاری شد"],
|
||||
["FIRST_DESCRIPTION_SUBMITTED", "توضیحات طرف اول ثبت شد"],
|
||||
["EXPERT_REPLY_SUBMITTED", "پاسخ کارشناس ثبت شد"],
|
||||
])("localizes sample timeline event %s", (type, expectedLabel) => {
|
||||
expect(getEventFaLabel({ type })).toBe(expectedLabel);
|
||||
});
|
||||
|
||||
it("uses a Persian faLabel fallback for an unknown event type", () => {
|
||||
expect(getEventFaLabel({ type: "UNRECOGNIZED_EVENT" })).toBe(
|
||||
"رویداد پرونده",
|
||||
);
|
||||
});
|
||||
|
||||
it("localizes human-readable assignment metadata", () => {
|
||||
expect(
|
||||
localizeTimelineMetadata({
|
||||
type: "CLAIM_ASSIGNED",
|
||||
metadata: { note: "Expert assigned via review assign endpoint" },
|
||||
}),
|
||||
).toEqual({
|
||||
note: "پرونده از طریق فرایند بررسی به کارشناس تخصیص داده شد.",
|
||||
});
|
||||
});
|
||||
|
||||
it("localizes Fanavaran errors while retaining machine-facing metadata", () => {
|
||||
expect(
|
||||
localizeTimelineMetadata({
|
||||
type: "FANAVARAN_EXPERTISE_AUTO_SUBMIT_FAILED",
|
||||
metadata: {
|
||||
clientKey: "parsian",
|
||||
error: "Fanavaran expertise payload is not ready.",
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
clientKey: "parsian",
|
||||
clientFaLabel: "پارسیان",
|
||||
error: "اطلاعات کارشناسی برای ارسال به فناوران آماده نیست.",
|
||||
});
|
||||
});
|
||||
|
||||
it("adds Persian labels for displayable metadata enums", () => {
|
||||
expect(
|
||||
localizeTimelineMetadata({
|
||||
type: "STEP_COMPLETED",
|
||||
metadata: {
|
||||
role: "FIRST",
|
||||
stepKey: "USER_SUBMISSION_COMPLETE",
|
||||
carType: "sedan",
|
||||
captureType: "angle",
|
||||
captureKey: "front",
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
role: "FIRST",
|
||||
roleFaLabel: "طرف اول",
|
||||
stepKey: "USER_SUBMISSION_COMPLETE",
|
||||
stepFaLabel: "ارسال اطلاعات توسط کاربر",
|
||||
carType: "sedan",
|
||||
carTypeFaLabel: "سواری",
|
||||
captureType: "angle",
|
||||
captureTypeFaLabel: "زاویه خودرو",
|
||||
captureKey: "front",
|
||||
captureKeyFaLabel: "نمای جلو",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user