forked from Yara724/api
Fixed Participants
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { RequestManagementService } from "./request-management.service";
|
||||
|
||||
describe("damaged-party inquiry requirements", () => {
|
||||
const getService = () => {
|
||||
const service = Object.create(
|
||||
RequestManagementService.prototype,
|
||||
) as RequestManagementService;
|
||||
(service as any).sandHubService = {
|
||||
getShebaValidation: jest.fn().mockResolvedValue({ valid: true }),
|
||||
};
|
||||
return service;
|
||||
};
|
||||
|
||||
it("requires Sheba when the claimant/damaged-party validation runs", async () => {
|
||||
const service = getService();
|
||||
|
||||
await expect(
|
||||
(service as any).validateShebaV3(
|
||||
undefined,
|
||||
"0012345678",
|
||||
"client-id",
|
||||
),
|
||||
).rejects.toThrow("sheba is required for the damaged party.");
|
||||
expect(
|
||||
(service as any).sandHubService.getShebaValidation,
|
||||
).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("validates damaged-party Sheba against the vehicle owner's national code", async () => {
|
||||
const service = getService();
|
||||
|
||||
await (service as any).validateShebaV3(
|
||||
"IR123456789012345678901234",
|
||||
"0012345678",
|
||||
"client-id",
|
||||
);
|
||||
|
||||
expect(
|
||||
(service as any).sandHubService.getShebaValidation,
|
||||
).toHaveBeenCalledWith("0012345678", "IR123456789012345678901234", {
|
||||
clientId: "client-id",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user