fix(car-body): validate policy coverage on accident date

Validate hull coverage against the accident date, select the covering renewal, and defer validation until that date is collected.
This commit is contained in:
2026-11-21 12:04:09 +03:30
parent 8f15040080
commit 5c6e21dd14
13 changed files with 499 additions and 56 deletions
+20
View File
@@ -37,6 +37,26 @@ describe("SandHubService inquiry mocks", () => {
},
} as SandHubDetailDto;
it.each(["IRNKAEK4150012345", userDetail.plate])(
"forwards only accidentDate for dated hull inquiries (%s)",
async (plate) => {
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
lookupsService.findLastProcessedCarPolicy.mockResolvedValue({
policy: {},
vehicle: {},
});
await service.getCarBodyInquiry({
...userDetail,
plate,
accidentDate: "1400/12/28",
});
expect(lookupsService.findLastProcessedCarPolicy).toHaveBeenCalledWith(
"car-body",
expect.objectContaining({ accidentDate: "1400/12/28" }),
);
},
);
beforeEach(() => {
jest.clearAllMocks();
process.env.CLIENT_ID = "8";