fix: return inquiry-specific Persian not-found messages

This commit is contained in:
2026-11-18 12:31:44 +03:30
parent 7631a94071
commit 2cdbc35d2e
6 changed files with 99 additions and 34 deletions
+27 -4
View File
@@ -181,7 +181,28 @@ describe("SandHubService inquiry mocks", () => {
);
});
it("preserves ESG messageFa for a plate inquiry", async () => {
it("returns a contextual error for an ESG person inquiry with no match", async () => {
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
jest.spyOn(service as any, "makeEsgRequest").mockResolvedValue({
success: false,
provider: "PARSIAN",
trackingCode: "INQ-20261118-B5C117CC",
data: null,
error: {
code: "RECORD_NOT_FOUND",
message: "Record not found",
messageFa: "رکوردی یافت نشد",
providerMessage: "err.record.not.found",
providerCode: "RECORD_NOT_FOUND",
},
});
await expect(
service.getPersonalInquiry("0012345678", "1370/01/01"),
).rejects.toThrow("استعلام مشخصات هویتی یافت نشد");
});
it("returns a contextual ESG not-found message for a plate inquiry", async () => {
process.env.CLIENT_ID = "8";
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
jest.spyOn(service as any, "makeEsgRequest").mockResolvedValue({
@@ -199,10 +220,12 @@ describe("SandHubService inquiry mocks", () => {
enforceDeploymentClientMatch: true,
});
expect(result.mapped.Error.Message).toBe("رکوردی یافت نشد");
expect(result.mapped.Error.Message).toBe(
"بیمه‌نامه شخص ثالثی مطابق پلاک و کد ملی واردشده یافت نشد.",
);
});
it("preserves ESG messageFa for a VIN inquiry", async () => {
it("returns a contextual ESG not-found message for a VIN inquiry", async () => {
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
jest.spyOn(service as any, "makeEsgRequest").mockResolvedValue({
success: false,
@@ -221,7 +244,7 @@ describe("SandHubService inquiry mocks", () => {
});
expect(result.mapped.Error.Message).toBe(
"نتیجه‌ای مطابق با اطلاعات وارد شده یافت نشد",
"بیمه‌نامه شخص ثالثی مطابق شماره شاسی (VIN) و کد ملی واردشده یافت نشد.",
);
});